Print Page | Close Window

LoadFromFile return 0

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=1595
Printed Date: 29 Apr 25 at 3:23PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: LoadFromFile return 0
Posted By: gcaramia
Subject: LoadFromFile return 0
Date Posted: 07 Oct 10 at 2:14PM
Please,
i have no idea why LoadFromFile, sometimes returns 0.
These .pdf files are generated by a Brother Scanner (may be this is the matter). They are well opened by Acrobat Reader and other readers.

Here my sample code:

procedure TForm1.Button1Click(Sender: TObject);
var
PDFLibrary: TQuickPDF0721;
UnlockResult: Integer;
risultato : integer;

begin
  WebBrowser1.Navigate('c:\I300.pdf'); <<<<< I300.pdf is shown >>>>>>>>>>>
  PDFLibrary := TQuickPDF0721.Create;
  try
    UnlockResult := PDFLibrary.UnlockKey('mykey');
    if UnlockResult = 1 then
      begin
        risultato := PDFLibrary.LoadFromFile('c:\I300.pdf');
        showmessage(inttostr(risultato)); <<<<<<<<< "0" is shown >>>>>>>>>>>>>>>>
        PDFLibrary.SaveToFile('C:\test.pdf');<<<<<<<<< empty document >>>>>>>>>>>
      end
    else
      begin
        ShowMessage('Invalid license key');
      end;
  finally
     PDFLibrary.Free;
  end;
end;

Here the I300.pdf:
www.winsvetta.com/QP/I300.zip

I can't figure out how can solve. Please, HELP.

Thx
Giovanni





Replies:
Posted By: Rowan
Date Posted: 20 Oct 10 at 1:49PM
Hi Giovanni,

The I300.pdf file is a malformed PDF. I opened the PDF in Acrobat and ran a "Preflight > Report PDF syntax issues" report. The report confirmed that the document is malformed with this message:

"The PDF document is damaged. While Acrobat always tries to repair the document when it is opened, there is no guarantee that the document can be processed reliably."

Adobe Reader, Acrobat and some other PDF viewers try to open and display PDF files even if they are malformed, but they make no guarantees that you'll actually be able to do anything else with a malformed PDF.

Quick PDF Library does not attempt to repair malformed PDF files and so it cannot open this particular document. If all of the PDF files that are generated by your Brother Scanner then I would highly recommend letting them know so that they can fix this issue at the source.

Cheers,
- Rowan.


Posted By: gcaramia
Date Posted: 20 Oct 10 at 2:17PM
Thx Rowan
I was almost sure about Brother responsability. You confirm my hypothesis but, more, your declaration helps me to prove to customer that the malfunction is not the fault of my software.

thx again
Giovanni



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