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

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
sau002  
#1 Posted : Wednesday, September 4, 2019 10:43:17 AM(UTC)
Quote
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 7 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)
Quote
Paul Rayman

Rank: Administration

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

Thanks: 3 times
Was thanked: 109 time(s) in 106 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

Quick Reply Show Quick Reply
Users browsing this topic
New Topic Post Reply
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.