Rank: Newbie
Groups: Registered
Joined: 8/17/2019(UTC) Posts: 6 
|
Hi All, I am trying to work out a logic to determine when a text should be broken down. I am using the function FPDFTextObj_GetSpaceCharWidth to determine the width of the space character. This approach generally appears to be work well. However, for some documents, the space width is zero for some of the text blocks. What could cause this? Example In the sample document the word "Forecasts" in the table header . Thanks, Sau macro_GS1.page21.zip (256kb) downloaded 17 time(s).Edited by user Wednesday, September 4, 2019 7:44:47 AM(UTC)
| Reason: Added sample document
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Hi, I can not reproduce this on your example Code:
static void Main(string[] args)
{
PdfCommon.Initialize();
var doc = PdfDocument.Load("e:\\0\\4\\macro_GS1.page21.pdf");
for(int i = 0; i< doc.Pages[0].PageObjects.Count; i++)
{
if (!(doc.Pages[0].PageObjects[i] is PdfTextObject))
continue;
var txt = (doc.Pages[0].PageObjects[i] as PdfTextObject).TextUnicode;
if (txt != "Our FX forecasts ")
continue;
float w;
Pdfium.FPDFTextObj_GetSpaceCharWidth(doc.Pages[0].PageObjects[i].Handle, out w);
Console.WriteLine(w);
}
}
Code:
0.278
Press any key to continue . . .
Edited by user Thursday, September 5, 2019 6:15:54 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can 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