Free Support Forum -

FormField Dimensions in Pdf


Is there a way to control the height and/or width of a text input Form Field that is created when saving to a Pdf file, using the "legacy" pdf save method? I'm inserting a text Form Field using the "InsertTextInput" method and it seems that, regardless of the font size used, the text input is always the same height when viewed in Adobe Reader. This causes problems when the font is too large for the height of the input box, as you cannot see the text being typed in. I would have expected the height to automatically stretch to fit the font being used.



<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. As you may know, currently Aspose.Words supports two ways of PDF conversion.

Unfortunately, the direct method does not support PDF Form Fields yet. I linked your request to the appropriate issue. You will be notified as soon as this feature is supported.

Regarding the “legacy” method, I think you should ask this question in Aspose.Pdf forum. As I can see, Aspose.Words output font size of formfield correctly into the intermediate XML. I used the following code for testing:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

FormField field = builder.InsertTextInput("test", TextFormFieldType.RegularText, "", "test", 0);

field.Font.Size = 24;

doc.SaveOptions.PdfExportFormFieldsAsText = false;

doc.SaveOptions.ExportPrettyFormat = true;

doc.Save(@"Test001\out.xml", SaveFormat.AsposePdf);

Here is XML produced by this code:

<?xml version="1.0" encoding="UTF-8"?>

<Pdf xml:space="preserve" TabStopPosition="36" IsCoreFontUsed="false" IsPageNumberForDocument="true" xmlns="Aspose.Pdf">

<Section PageWidth="612" PageHeight="792" PageMarginTop="72" PageMarginBottom="72" PageMarginLeft="90" PageMarginRight="90" IsNewPage="true">

<Text IsSpaced="true" LineSpacing="3.6" ID="paraId_1">

<Segment ID="test" />


<<?xml:namespace prefix = st2 ns = "urn:schemas-microsoft-com:office:smarttags" /><?xml:namespace prefix = st1 ns = "urn:schemas:contacts" />FormField FormFieldType="Text" FieldName="test" IsBordered="true" TextIsMultiLine="true" TextFontSize="24" TextColor="gray 0" BackgroundColor="gray 0" FieldValue="test" />





Best regards.

The issues you have found earlier (filed as 6798) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.