We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document with mixed portrait and landscape form fields

We are building an application that must insert form fields, and then fill them, in documents that have a mix of portrait and landscape forms on the same page (see attached). The portrait form fields are not a problem, but when we try to set the FormFieldFacade.Rotation = 90 on a form field it doesn’t seem to have any effect. Do you have any code samples we can look at that use this property? We have been unable to find any.



Hi Scott,

Thanks for contacting support.

but when we try to set the FormFieldFacade.Rotation = 90 on a form field

Please note that you are using an old legacy (Aspose.Pdf.Facades) approach for working with forms. Whereas it is strongly recommended to use new DOM (Aspose.Pdf) approach.

I have added a TextboxField with rotation in the PDF document which you have shared using new approach. Please check the following code snippet to add form field with its rotation angle set. I have added the TextboxField against the text “Tenant Vacated” in the landscape portion of the document. I have also attached an output generated by the code for your reference.

Document pdfDocument = new Document(dataDir + “jac_dispo_back.pdf”);

TextBoxField textBoxField = new TextBoxField(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(95, 95, 115, 175));

textBoxField.PartialName = "textbox1";

textBoxField.Value = "Text Box";

Pdf.Annotations.Border border = new Pdf.Annotations.Border(textBoxField);

border.Width = 5;

border.Effect = Pdf.Annotations.BorderEffect.Cloudy;

border.Dash = new Pdf.Annotations.Dash(1, 1);

textBoxField.Border = border;

textBoxField.Characteristics.Background = Color.AliceBlue;

textBoxField.Characteristics.Rotate = Rotation.on270;

// Add field to the document

pdfDocument.Form.Add(textBoxField, 1);

dataDir = dataDir + "rotatedformfield.pdf";

// Save modified PDF


You may check the further information regarding DOM in "Working with Aspose.Pdf" section of our API documentation. In case if you need any further assistance please feel free to contact us.

Best Regards,