public virtual byte[] CreateForm() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfDocument pdfDoc = new PdfDocument(new PdfWriter(baos)); Rectangle rect = new Rectangle(36, 720, 108, 86); PdfTextFormField textFormField = PdfFormField.CreateText(pdfDoc, rect, FIELD_NAME, "text"); // Being set as true, the field can contain multiple lines of text; // if false, the field's text is restricted to a single line. textFormField.SetMultiline(true); PdfAcroForm.GetAcroForm(pdfDoc, true).AddField(textFormField); pdfDoc.Close(); return(baos.ToArray()); }
public byte[] CreateForm() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfDocument pdfDoc = new PdfDocument(new PdfWriter(baos)); PdfFont font = PdfFontFactory.CreateFont(); PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDoc, true); Rectangle rect = new Rectangle(36, 770, 104, 36); PdfTextFormField textField = PdfFormField.CreateText(pdfDoc, rect, "text", "text", font, 20f); // Being set as true, the field can contain multiple lines of text; // if false, the field's text is restricted to a single line. textField.SetMultiline(true); form.AddField(textField); pdfDoc.Close(); return(baos.ToArray()); }