logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
sau002  
#1 Posted : Wednesday, September 4, 2019 10:43:17 AM(UTC)
sau002

Rank: Newbie

Groups: Registered
Joined: 8/17/2019(UTC)
Posts: 6
United Kingdom

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 1 time(s).

Edited by user Wednesday, September 4, 2019 10:44:47 AM(UTC)  | Reason: Added sample document

Paul Rayman  
#2 Posted : Thursday, September 5, 2019 9:13:50 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 789

Thanks: 1 times
Was thanked: 98 time(s) in 96 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 9:15:54 PM(UTC)  | Reason: Not specified

Users browsing this topic
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.