Rank: Newbie
Groups: Registered
Joined: 5/21/2018(UTC) Posts: 3 
|
Dear friends, When I extract the text from the pdf file, there are some characters that are placed in the wrong postion. Per example, in the pdf the text is "INALGEX®, 50 mg/g | 100 m g/g, Gel" and the extracted text is "INALGEX , 50 mg/g | 100 m g/g, Gel ®". The ® moved to the end of the line when the text was extracted. I'm attaching an image showing my problem. My goal is to extract the full text from the pdf file. I'm using the following function: public static string ExtractFullText(ppsPdfViewer viewerObj) { string fullText = string.Empty; var doc = viewerObj.Document; foreach (var page in doc.Pages) { //Gets number of characters in a page or -1 for error. //Generated characters, like additional space characters, new line characters, are also counted. int totalCharCount = page.Text.CountChars; //Extract text from page to the string string pageText = page.Text.GetText(0, totalCharCount); fullText += pageText; page.Dispose(); } return fullText; } Any ideas how could I fix these? Thanks in advance, Felipe  textExtraction.png (85kb) downloaded 18 time(s).
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 5/21/2018(UTC) Posts: 3 
|
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Could you please provide PDF document
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 5/21/2018(UTC) Posts: 3 
|
Hi Paul, This is the file that I used in my tests.  2_Leaflet_Master.pdf (1,416kb) downloaded 5 time(s).Thanks a lot! Felipe
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
A PDF document is not a Flow Document. PDF contains text objects that have a number of properties, including the coordinates on the page. In this case, there are four text objects which represent the text in the first line. In order to convert these text objects to the flowing text, a algoriths is used that take into account the ordinal number of the text objects. The fact that the text from this line is extracted in same manner in both Pdfium and in such programs as Adobe Reader and Foxit Phatom Reader indicates that the algorithm probably does not have an error. Looks like the problem with the the document. Maybe you need to change the order of text objects. Please see the video below. I hope that the situation immediately becomes clear. Edited by user Monday, July 16, 2018 9:57:27 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Forum Jump
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.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close