Check corrupt PDF file

Hi,
I’m making a script that check’s if a pdf file is corrupt or not.

require ‘watir’
require ‘win32ole’
require ‘pdf/writer’

oPDF = WIN32OLE.new(‘AcroExch.App’)
oPDFDoc = WIN32OLE.new(‘AcroExch.AVDoc’)

if (oPDFDoc.Open(“c:\tempcor.pdf”,"") !=true)
puts “false” #problem…press enter
else
puts “true”
end

Now, the problem is, when opening a corrupt pdf, a message appears in
Adobe.
Does anyone know how to check it without the message or get the message
out of the way?

cheers.
FF

oke, fixed it with this:

Before opening the pdf I call this def:

def startClicker(waitTime = 3)
sleepTime = waitTime
puts “in clicker”
@wsh = WIN32OLE.new(‘Wscript.Shell’)
@wsh.SendKeys(’{enter}’)
end

Any better idea’s are welcom (don’t like sendkeys solutions that
much…)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs