Padding layout attribute for TextBoxField

Hi,

I have a TextBoxField and I would like to get it’s structural layout attributes e.g. padding. How can I do this with Aspose.Pdf.Net 25.12 ?

Thanks

@gkrasznai

You want to retrieve padding layout attributes for a TextBoxField in Aspose.Pdf.Net 25.12, but the TextBoxField class does not expose a direct padding property . You can work with related properties like Margin, Border, and Alignment to manage spacing.

Here’s how you can approach it:

  1. Access Margin Property: The Margin property lets you define spacing around the field . Although this isn’t padding directly, it sets the space outside the field’s boundaries.
// Example of setting margin
textBoxField.Margin = new Margin(5, 5, 5, 5); // top, right, bottom, left
  1. Check Border Properties: Inspect or set the Border property to see if there’s any border thickness affecting layout .
textBoxField.Border = new Border(textBoxField) { Width = 1 };
  1. Alignment Settings: Use TextHorizontalAlignment and TextVerticalAlignment to manage text alignment within the field, which can influence perceived spacing .

In summary, while Aspose.Pdf.Net 25.12 doesn’t provide a dedicated padding property for TextBoxField, you can manage layout spacing using Margin, Border, and alignment settings .

Padding is a low level structural attribute of pdf elements. I am aware that this is not available through textboxfield properties. You should tell me how to retrieve the corresponding Aspose.Pdf.Tagged.LogicalStructure.AnnotationElement for a Aspose.Pdf.Forms.TextBoxField.

@gkrasznai

We need to investigate the feasibility of this requirement internally. Can you please share a sample PDF document for our reference? We will log an investigation ticket in our issue tracking system and share the ID with you.

Hi,

  1. create a blank document from code
  2. add a blank page from code
  3. add a textbox to that page

btw. we have license for Aspose.Pdf and others…