Print Page | Close Window

problems with GetPageText()

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=2484
Printed Date: 28 Jan 26 at 5:44PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: problems with GetPageText()
Posted By: tj asher
Subject: problems with GetPageText()
Date Posted: 09 Jan 13 at 7:26PM
Hello,
 
Using Delphi XE2 and version 912 of Debenu Library VCL component.
 
Doing a GetPageText I get some odd decoding issues with some PDFs.
 
A snippet of my code to get the page text which is pretty straigt forward:
 
          for x := 1 to PDFLibrary.PageCount do begin
            PDFLibrary.SelectPage(x);
            Memo1.Text := Memo1.Text + PDFLibrary.GetPageText(7);//passing 7 preserves formatting
          end;
 
Here is how the text looks on the PDF. You'll have to trust me that it looks like this since I cannot post a screen shot.
 
Tax
        Labor Tax          @    7.00%        $4.20  
        Parts Tax           @    7.00%      $27.75  
  Tax Total                                       $31.95
 
 
When I get the page text I get stuff like this:
 
Tax
                                             $4.20
           Labor Tax   @       7.00%        $27.75
                      @
            Parts Tax
                               7.00%
 Tax Total                                  $31.95
 
I'm guessing there is something wacky about how this PDF is created. Is there anything I can do to get my page text in a format more closely to how it shows on the actual PDF? I need the text to be properly formatted to parse it.
 
Thanks for any advice.
 
Regards,
TJ Asher
 



Replies:
Posted By: Ingo
Date Posted: 09 Jan 13 at 8:21PM
Hi TJ!

Option 7 is best for your needs.
For better parsing you can try the word-by-word-extraction option.
Another idea: Do the extraction with the additional data regarding textformatting and positions.
Then you can do the layout by your own.

Cheers and welcome here,
Ingo



Posted By: tj asher
Date Posted: 09 Jan 13 at 10:02PM
Ingo,

I am using option 7 but for some reason the actual text returned *from* the page is not how it looks *on* the page.

I will consider the option of the text with data positions.
 
Trying to use Acrobat or Foxit PDF Reader and selecting just the text in question is difficult as other areas get selected that don't appear related so I suspect flaws in the orginization of the PDF document itself.
 
Regards,
TJ Asher


Posted By: AndrewC
Date Posted: 13 Jan 13 at 1:48PM
We would need to see the actual PDF to explain exactly why the results looks the way they do.  

I suspect the PDF uses different fonts and sizes for the text.  Text extraction is not an exact science and it is a bit like putting together a jigsaw puzzle.

Andrew.



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