check corrupt PDF file

F

Flaming Flamingo

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
 
F

Flaming Flamingo

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...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top