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!
![]() |
GetPageText returns an empty string... |
Post Reply ![]() |
Author | |
jdupond ![]() Beginner ![]() Joined: 13 Oct 09 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() 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; |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jdupond ![]() Beginner ![]() Joined: 13 Oct 09 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
Thanks for the tip.
I tried it but GetPageText still returns only empty strings. |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jdupond ![]() Beginner ![]() Joined: 13 Oct 09 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
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. |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
AIM ![]() Beginner ![]() Joined: 12 Aug 09 Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
I have tried this file here too and I'm also not able to extract text. Using v7.16 and Delphi 2009.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
AIM ![]() Beginner ![]() Joined: 12 Aug 09 Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
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! :) |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
AIM ![]() Beginner ![]() Joined: 12 Aug 09 Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
Thanks for clarification, Ingo.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store