# Check corrupt PDF file

**URL:** <https://www.ruby-forum.com/t/check-corrupt-pdf-file/127022>\
**Category:** Ruby\
**Created:** [January 24, 2008, 10:02am UTC](https://www.ruby-forum.com/t/check-corrupt-pdf-file/127022 "2008-01-24T10:02:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![flamingflamingo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f14d63/32.png) [@flamingflamingo](https://www.ruby-forum.com/u/flamingflamingo)\
**Post date:** [January 24, 2008, 10:02am UTC](https://www.ruby-forum.com/t/check-corrupt-pdf-file/127022/1 "2008-01-24T10:02:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![flamingflamingo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f14d63/32.png) [@flamingflamingo](https://www.ruby-forum.com/u/flamingflamingo)\
**Post date:** [January 24, 2008, 10:37am UTC](https://www.ruby-forum.com/t/check-corrupt-pdf-file/127022/2 "2008-01-24T10:37:02Z")

</div>

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