Posted by a ceTe Software moderator
Hello Giovanni,
You can get the field information from one PDF and create a similar field in another PDF without any problem.
PdfDocument pdf = new PdfDocument( filePath );
PdfFormField pdfField = pdf.getForm().getFields().getPdfFormField("fieldName");
float x = pdfField.getX( currPage );
float width = pdfField.getWidth();
You can use the above information to add new fields to another PDF.
Document document = new Document();
Page page = new Page();
//This text field is from com.cete.dynamicpdf.pageelements.forms.
TextField field = new TextField( "txt", x, y, width, height );
You can refer to the
TextField and
Form Flattening examples on our help documentation.
Thanks,
ceTe Software Support Team.