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



Go to last post Go to first unread
#1 Posted : Thursday, November 7, 2019 6:33:42 AM(UTC)

Rank: Member

Groups: Registered
Joined: 2/21/2019(UTC)
Posts: 13

In Adobe Acrobat a property can be set to give spacing between characters (called comb). Is there a way to use this setting in pdfium currently?

comb.png (11kb) downloaded 0 time(s).
Paul Rayman  
#2 Posted : Thursday, November 7, 2019 9:55:34 AM(UTC)
Paul Rayman

Rank: Administration

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

Thanks: 2 times
Was thanked: 103 time(s) in 101 post(s)
I guess this is combination of the

MaxLen integer (Optional; inheritable) The maximum length of the field’s text, in characters.


FieldFlags: bit position 25: Comb - (PDF 1.5) Meaningful only if the MaxLen entry is present in the text field
dictionary (see Table 8.78) and if the Multiline, Password, and FileSelect
flags are clear. If set, the field is automatically divided into as many equally
spaced positions, or combs, as the value of MaxLen, and the text is laid out
into those combs.

Therefore, you can read/set this value in the field's dictionary by reading/setting the MaxLen value and the corresponding flag.

using(var doc = PdfDocument.Load(@"e:\31\comb.pdf_decoded.pdf", new PdfForms()))
    var field = doc.FormFill.InterForm.Fields[0];
    var dict = field.Dictionary;
    int flags = field.Dictionary["Ff"].As<PdfTypeNumber>().IntValue;
    int maxLen = field.Dictionary["MaxLen"].As<PdfTypeNumber>().IntValue;
    bool combIsSet = (flags & 0x1000000) == 0x1000000;

    field.Dictionary["MaxLen"] = PdfTypeNumber.Create(15);
    doc.Save(@"e:\31\comb15.pdf", SaveFlags.NoIncremental);

The full description of all available flags can be found on pages 676, 686, 691, 693 of the PDF specification here:

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.