Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pdf checker
Message
From
17/01/2014 08:07:45
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01591849
Message ID:
01592073
Views:
59
>Hi
>I am using XFRX to create PDF's and then email them
>Very intermittently, unreadble PDF's are being created, but if I try again subsequently, with same documents etc , it creates the PDF fine.
>If there was a utility available to 'Check' if a Pdf could be opened, I could wrap this in a loop, and perhaps the second time it might be ok....maybe its a timimg thing or something else going on in the environment.
>
>Anybody know of a simple PdfChecker whcih would just return a True or false. I donmt want to waste time 'actually' opening the Pdf
>My Loop would read
>Do while i lt 5
> Create Pdf
> If Valid(MyPdf)
> Exit
> Endif
> If reached Here
> Wait window 'Still an error afert 5 attempts'
>Enddo
>
>Many thanks in advance
>Regards,
>Gerard

I got this off the web some time ago. You'll have to verify the command line with the version you are using.

Try GhostScript

After you've created the pdf, run the dos command: gswin32c.exe -o nul -sDEVICE=nullpage "c:\my.pdf"

That renders the pdf file and .rendering the PDF validates it

Read the file:

A valid PDF prints the lines page1, page2, page3, page4, etc (there should be page1 at least)

An invalid PDF usually has a final line that ends in "Unrecoverable error, exit code 1"

As far as I know, just checking for the error in the last line is probably the best you can do other than the pdf not being rendered at all.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform