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
stan  
#1 Posted : Thursday, November 7, 2019 3:33:42 AM(UTC)
Quote
stan

Rank: Member

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

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
Paul Rayman  
#2 Posted : Thursday, November 7, 2019 6:55:34 AM(UTC)
Quote
Paul Rayman

Rank: Administration

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

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
I guess this is combination of the

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


and

Quote:
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.

Code:
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:
https://www.adobe.com/co...ve/pdf_reference_1-7.pdf

Quick Reply Show Quick Reply
Users browsing this topic
Guest (2)
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.