Print Page | Close Window

extract Text (words)

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=1215
Printed Date: 01 Feb 26 at 1:38PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: extract Text (words)
Posted By: munteanu24d
Subject: extract Text (words)
Date Posted: 11 Sep 09 at 2:36PM
hello!

I am trying to get the text from a pdf file, using the getPageText(option) method.
I have tried option = 3 and option = 4.

When I print the text obtained with option 3, I get just the first word from each row, but the coordinates of the whole row.

When I print the text obtained with option 4, I get the fragmented piece of words, for instance for constant word, i get const and ant .

I need implement the find word functionality, but I cannot do it, as long as instead of the whole word, i get fragment of words.

What can I do?

P.S. I have tried for different pdfs and the result is the same.

best wishes,
D.M.



Replies:
Posted By: Ingo
Date Posted: 11 Sep 09 at 7:16PM
Hi D.M.!

Option 3 gets strings if strings were inserted.
It's not a must that the line of characters you can see in the pdf was inserted in one run.
Another thing is: If there was one word missed in a pdf-row and if it was inserted later ... so this word would be extracted as the last content of the page 'cause it was inserted late and it doesn't matter to which row it belongs.
If you get always one word with option 3 then i think that all pdf-documents are from the same source and that they are automatically generated.
You can send two samples to me then we can examine them:
ingo  -dot-  schmoekel  -at-   ewetel  -dot-  net
The other way round i can send you a file with "longer" strings ;-)

Cheers, Ingo



Posted By: munteanu24d
Date Posted: 15 Sep 09 at 10:30AM
Thank you for your answer. I Have changed the pdf files, and now I am managing to search for words in the rows, with option 3.

What I do not manage to do is to take the char width.


The _QP.CharWidth(myASCIcode) always returns a 0 value.
I have checked the selected font ID and it is also 0. Here might be the problem, but i do not manage to fix it... :(




Posted By: Ingo
Date Posted: 15 Sep 09 at 11:48AM
Hi!

With option=3 you get the value for font-height, too.
With a bit calculations regarding the other values (from the four rectangles) you can get the complete length, too.
If you want the character-length you can get the string-lenght with "len(...)", "length(...)" or any similar syntax in many languages.
So you have the string-length and the height and it shouldn't be a big problem to find/calculate a matching factor for each character-width.

Cheers, Ingo




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