Print Page | Close Window

LoadFromFile Hanging

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3162
Printed Date: 17 Jan 26 at 9:35PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: LoadFromFile Hanging
Posted By: mcourt
Subject: LoadFromFile Hanging
Date Posted: 15 Aug 15 at 11:34AM
Delphi.

Basically, this code has been running fine, but our application hung when it came across a corrupt pdf, rather than get trapped and handled by the except block it just hangs.

We know it is a bad PDF file because when we open it in Acrobat viewer we get this message: "There was an error opening this document. The file is damaged and could not be repaired."

So Adobe acrobat can trap and handle it, why will the current code not trap it:

//Note QP was created before and tmpfilepath has been set......as we mentioned it works fine for a good pdf file, so why do we not get the BADFile message

try
  QP.LoadFromFile(tmpFilePath);   //tmpFilepath is valid and points to the pdf
  showmessage('OK');
except
  showmessage('BAD File?');
end;


http://www.courtnell.com/badpdf/testbad.pdf" rel="nofollow - This is a link to the bad pdf.

It is vital to be able to handle bad pdf's to allow applications to handle gracefully and keep on processing....especially in batch systems.

We also tried variations of loadfromfile like
if QP.LoadFromFile(tmpFilePath) = 1
if QP.LoadFromFile(tmpFilePath) = 0

But still hangs.

Kind Regards
Mark




Replies:
Posted By: mLipok
Date Posted: 16 Aug 15 at 9:22PM
Hi.
I get:
! __QPDF_ErrorNotiffy:
>     $iResultError = 401
>     $sLastErrorDescription = Could not open input file

btw.
You must set password, as it is a required parameter
so you have to use:
if QP.LoadFromFile(tmpFilePath, "") = 1 
if QP.LoadFromFile(tmpFilePath, "") = 0


-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk