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 - GetPageText returns an empty string...
  FAQ FAQ  Forum Search   Register Register  Login Login

GetPageText returns an empty string...

 Post Reply Post Reply
Author
Message
jdupond View Drop Down
Beginner
Beginner


Joined: 13 Oct 09
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jdupond Quote  Post ReplyReply Direct Link To This Post Topic: GetPageText returns an empty string...
    Posted: 13 Oct 09 at 8:51PM
Hello,

We are using Delphi 5 and QuickPDF v. 5.22.

When we run the code below, on most 'pdf,' we do get the correct result in the 'iText' variable. But we have a few 'pdf' [not created with PrimoPDF] for which a call to 'GetPageText' always returns an empty string even though it should not [the underlying text can be viewed when the file is opened with PrimoPDF].

We have tried the latest version of QuickPDF (as a demo). The results are the same.

Does anybody may have an idea of what the problem might be?


// Let's 'create' the component used to read the 'pdf' file
iPDFSource:= TQuickPDF.Create(Self);
try
    // Let's unlock the access to the component's properties
    iPDFSource.UnlockKey('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    iPDFSource.LoadFromFile(aPDFFileName);
    // Let's decrypt the 'pdf' file if it is encrypted
    if (iPDFSource.Encrypted > 0) then
      iPDFSource.Unencrypt;
    // Let's determine the number of pages found within the 'pdf' file
    iNbPages := iPDFSource.PageCount();
    // If the file is not empty,
    if (iNbPages > 0) then begin
      // let's read the content of the 'pdf' file
      for iCpt := 1 to iNbPages do begin
        Application.ProcessMessages;
        iPDFSource.SelectPage(iCpt);
        iPDFSource.CombineLayers;
        iText := iPDFSource.GetPageText(0);
        if (Trim(iText) <> '') then
          ShowMessage(iText);
      end;
    end;
finally
    // Let's dispose of our 'pdf' reader
    iPDFSource.Free;
end;
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: 13 Oct 09 at 9:42PM
Hi!
This has nothing to do with your code.
I'm stumbling over this problem for years now.
There are problems with documents which were created by a pdf-printer-driver in combination with the ghostscript library up to version 8.14 (since 8.15 it's okay).
So i think it will be always old documents with the described problems.
My work around in this case:
First extracting with option 3 and if there isn't content then a second run with option 0.
Cheers and welcome here,
Ingo
 
Back to Top
jdupond View Drop Down
Beginner
Beginner


Joined: 13 Oct 09
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jdupond Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 09 at 7:16PM
Thanks for the tip.

I tried it but GetPageText still returns only empty strings.
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: 14 Oct 09 at 7:23PM
Hi!
It would be good to know author, creator, encryption strength and used pdf-specs of these files ...
Can you upload these files anywhere for us to check them?
Cheers, Ingo

Back to Top
jdupond View Drop Down
Beginner
Beginner


Joined: 13 Oct 09
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jdupond Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 09 at 8:30PM
Hello,

I posted the file for download at the following url: click here.

Nevertheless, I don't know if it worth spending any time working on it since I just found out that our customer would like us to change one of the font used within the 'pdf.' As far as I understand, that is not possible with QuickPDF.
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: 14 Oct 09 at 8:43PM
Hi!

I've no problems with this file.
Option 0 and option 3 are working fine.

Your code is okay, too... but this line
 " ... if (iNbPages > 0) then begin ... "
you don't need. A pdf has minimum one page.
If there's no page then the dictionary is corrupt.

This here is only a user-user-forum so please send your code and file to this location:
http://www.quickpdflibrary.com/support/index.php

Cheers, Ingo

Back to Top
AIM View Drop Down
Beginner
Beginner


Joined: 12 Aug 09
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote AIM Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 09 at 9:32AM
I have tried this file here too and I'm also not able to extract text. Using v7.16 and Delphi 2009.
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: 15 Oct 09 at 9:39AM
This here is only a user-user-forum so please send your code and file to this location:
http://www.quickpdflibrary.com/support/index.php

Cheers, Ingo

Back to Top
AIM View Drop Down
Beginner
Beginner


Joined: 12 Aug 09
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote AIM Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 09 at 12:14PM

Quote This here is only a user-user-forum so please send your code and file to this location:

I understood that, but since you (as user) could extract text from the provided file I just wondered how you did that while it doesn't work for at least two other users ("jdupond" and "AIM")? Since you didn't have a problem with that file, did it work with the code from "jdupond", or have you used another code? A tip from a user with success to users without success would be highly appreciated! :)

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: 15 Oct 09 at 1:07PM
Hi AIM!

I've a source license with personal changes and so i can extract...
So i think this problem from the compiled version can be solved...
and so i suggest to send it to the owners of the library - they'll solve the bug.

Cheers, Ingo


Edited by Ingo - 15 Oct 09 at 1:07PM
Back to Top
AIM View Drop Down
Beginner
Beginner


Joined: 12 Aug 09
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote AIM Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 09 at 1:33PM
Thanks for clarification, Ingo.
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. AboutContactBlogSupportOnline Store