PDF Forms

HTML with form fields can also be rendered to PDF with the form field information and functionality intact. Create an editable PDF form from HTML content involves defining an HTML form with various input fields like text fields, radio buttons, and checkboxes. These form elements allow users to input data and make selections.

To achieve this, set the createPdfFormsFromHtml option to true. This option specifies that the HTML form should be converted into an editable PDF form.

Next, render the HTML content into a PDF document using the PdfDocument.fromHtml method. Pass the specified rendering options as an object parameter.

Finally, export the editable form field PDF as a new PDF file named "formField.pdf" using the saveAs method.