Free Support Forum - aspose.com

Adding form field to a pdf

Hello,
I was wondering if with aspose it’s possible to add a formfield setting it’s dimension and position in mm(or cm) …

Is there any example?
Thanks

Hello,
I’ve succeded in doing

public void DoWork(string source, IEnumerable items)
{
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(source);

FormEditor formEditor = new FormEditor(pdfDocument);

foreach (var item in items)
{
var rect = GetRectangle(item);
TextBoxField textBoxField = new TextBoxField(pdfDocument.Pages[item.Page], rect);

textBoxField.Name = item.ItemName;
textBoxField.Value = item.ItemName;

pdfDocument.Form.Add(textBoxField, item.Page);
}

pdfDocument.Save(@“c:\temp\output.pdf”);
}

Just a question…how can I set the textfield font/font-size?
Thanks

Hi Michele,


Thanks for your inquiry. Please check following documentation link for setting form field fonts and size. Hopefully it will serve the purpose.


Please feel free to contact us for any further assistance.

Best Regards,

Thank a lot for your response,
how can I set the font and font-size? Is there a class for converting cm /inch to points?
Thanks

Hi Michele,


Thanks for your inquiry. Are you getting some issue in setting font and font size? as above shared document link demonstrate how to set font and font size.

Furthermore in reference to points to cm/inch conversion, please check the document describing the details. Hopefully it will resolve the issue.

Please feel free to contact us for any further assistance.

Best Regards,