Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - LoadFromFile failed (Delphi 2007) .. why?
  FAQ FAQ  Forum Search   Register Register  Login Login

LoadFromFile failed (Delphi 2007) .. why?

 Post Reply Post Reply
Author
Message
ZarkoGajic View Drop Down
Beginner
Beginner
Avatar

Joined: 18 Mar 09
Location: Croatia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote ZarkoGajic Quote  Post ReplyReply Direct Link To This Post Topic: LoadFromFile failed (Delphi 2007) .. why?
    Posted: 18 Mar 09 at 8:56AM
Hi,
 
I have a PDF file that refuses to be loaded using TQuickPDF0712 (Delphi 2007) LoadFromFile method.
 
The result of the function is "0 - The file could not be read or processed".
 
The PDF is not password protected. It loads in Adobe Reader and FoxIt.
 
p.s.
Other documents load with no problems.
 
How to determine the cause of this problem? Can I upload this PDF somewhere for a test?
 
-zarko gajic
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 9:30AM
Hi Zarko!

You can send it to me at
ingo -dot- schmoekel -at- ewetel -dot- net
BTW: Are you the Zarko from delphi.about.com?

Welcome here!

Cheers, Ingo

Back to Top
ZarkoGajic View Drop Down
Beginner
Beginner
Avatar

Joined: 18 Mar 09
Location: Croatia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote ZarkoGajic Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 10:59AM
Ingo,
 
Thanks for the offer.
 
I "know" that the file is corrupted .. I just am not sure why it loads with Acrobat Reader with no problems .. plus it would be great if when LoadFromFile fails .. a more descriptive error is provided.
 
p.s.
PDF sent to your email..
 
p.s.
Yes, Zarko Gajic from delphi.about.com :)
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 11:05AM
Hi Zarko
 
The most frenquetly corrupted pdf are corrupted in the cross reférence (generaly at the end of the file). When Acrobat reader find this kind of corruption, he corrects the problem with a complete reconstruction of cross reference.
 
I suppose QuickPdf library will do it in a near future.
 
Cheers
 


Edited by DELBEKE - 18 Mar 09 at 11:06AM
Back to Top
ZarkoGajic View Drop Down
Beginner
Beginner
Avatar

Joined: 18 Mar 09
Location: Croatia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote ZarkoGajic Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 11:21AM
Hi,
 
How about some kind of descriptive (error) message to why the LoadFromFile has failed?
 
-zarko
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 12:10PM
Of course, these would be kind ;)
 
But not easy to implement I think. A easyer way should be a return value more significant, actualy 0, all is correct and 1, load has fail.


Edited by DELBEKE - 18 Mar 09 at 12:11PM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 3:03PM
Hi Zarko!

I've looked inside with PSPad (you can use any other editor as well).
The first content you can see below.
I've deleted the string "%%EOF", made a new save and then QuickPDF had no problem to read/load the file! It's a distiller document initially created with Word. Where this E(nd)O(f)F(ile) comes from... i don't know? A real accident ;-)
A 100 mb adobe reader installation can handle this - for the 2 mb of QuickPDF it's not so easy i fear.

Cheers, Ingo

%PDF-1.5
%âãÏÓ
10 0 obj
<</Linearized 1/L 6181/O 12/E 1733/N 1/T 5934/H [ 456 163]>>
endobj
                    
xref
10 8
0000000016 00000 n
0000000619 00000 n
0000000731 00000 n
0000000927 00000 n
0000001075 00000 n
0000001413 00000 n
0000001656 00000 n
0000000456 00000 n
trailer
<</Size 18/Prev 5923/Root 11 0 R/Info 9 0 R/ID[<CA83DDF33197EBFD70368E5A30920D4E><900CDB0B84391E449A21F582F7E253EB>]>>
startxref
0
%%EOF
               
17 0 obj
<</Length 73/Filter/FlateDecode/I 101/L 85/O 69/S 38>>stream
xÚb```e``²`


Edited by Ingo - 18 Mar 09 at 3:05PM
Back to Top
ZarkoGajic View Drop Down
Beginner
Beginner
Avatar

Joined: 18 Mar 09
Location: Croatia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote ZarkoGajic Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 3:19PM
Ingo,
 
Thanks for the info.
 
I do not have any idea what this EOF is doing there :(
 
p.s.
Need to process a bunch of PDFs in my application and this file failed to load.
 
What is important here is that this file IS corrupted - the fact that AdobeReader can read it .. who cares .. for me it would be enough to report as "cannot open file".
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 3:59PM
Hi zarko
 
In fact it does indicate you that the file can' be laoded.
Here is a sample writen in vb6
 
    On Error Resume Next
    lRet = m_oDoc.LoadFromFile(Value)
    On Error GoTo 0
    If lRet = 0 Then
        MsgBox "File can not be opened", vbCritical
        Exit Sub
    End If
 
 
Back to Top
ZarkoGajic View Drop Down
Beginner
Beginner
Avatar

Joined: 18 Mar 09
Location: Croatia
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote ZarkoGajic Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 6:48PM
Delbeke,
 
I am aware of the function result value ... my question was initially related to "why" does it fail to load - since AReader can open it.
 
The answer was provided by Ingo.
Back to Top
deabrew View Drop Down
Newbie
Newbie
Avatar

Joined: 19 Jan 09
Status: Offline
Points: 43
Post Options Post Options   Thanks (0) Thanks(0)   Quote deabrew Quote  Post ReplyReply Direct Link To This Post Posted: 18 Mar 09 at 7:56PM
Zarko, Delbeke, and Ingo (plus readers),

We're working on providing a solution for this problem to include in an upcoming version (7.13) of Quick PDF Library.

Today, the production version of 7.12 will be released.

And thanks all.

Cheers, -Karl

-Karl
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 19 Mar 09 at 2:35AM
The problem don't come with this %%EOF. This is a linearized pdf. A pdf can contain more than one %%EOF in 2 cases : linearisation and incremental save. The real problem come with startxref 0. That QuickPdf can not handle at the momment.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store