


Then, we send them out from the worker and render them in the main process using HTML elements inserted in a div (annotation layer). In PDF.js, we parse a PDF file and create the annotations in a web worker. AcroForm annotation elements support user input similar to HTML input e.g. They are often used for things like taking notes on a document or drawing on top of a document. Annotations in PDF are separate elements from the main content of a document. Within a PDF file, the form elements are stored in the annotation data. Filling Forms (AcroForms)ĪcroForms are one of two types of forms that PDF supports, the most common type of form. They support form filling and we will describe them in more detail below. The other two layers are the Annotation/AcroForm layer and the XFA form layer. It contains span elements that are transparent and line up with the text drawn below them on the canvas. The first layer, the text layer, enables text selection and search. PDF.js sends them to the main thread and draws them on an HTML5 canvas element.īesides the canvas, PDF.js potentially creates three more layers that are displayed on top of it. The parsed document will then generate drawing instructions. To understand how we added support for forms and tagged PDFs, it’s first important to understand some basics about how the PDF viewer (PDF.js) works in Firefox.įirst, PDF.js will fetch and parse the document in a web worker. Below we’ll describe how we implemented the form support, improved accessibility, and made sure we had no regressions along the way. While we invested more time in the PDF viewer, we also went through the backlog of work and prioritized improving the accessibility of our PDF reader for users of assistive technologies. We decided it was time to reinvest in the PDF viewer (PDF.js) and support filling PDF forms within Firefox to make our users’ lives easier. Firefox supported displaying PDF forms, but it didn’t support filling them: users had to print them, fill them by hand, and scan them back to digital form. The following clauses describe how XFA is integrated into PDF, where the schema (template)ĭescription can be found within the PDF, and where the various types of XML data can be found.Last year, during lockdown, many discovered the importance of PDF forms when having to deal remotely with administrations and large organizations like banks. The implementation of such a schema driven page generation involves considerable effort beyond thatįor a simple PDF viewer and therefore a PDF processor may choose to not implement this feature. When the exact number of invoice items is determined, using the directives found in the XFA schema, a specific set of pages can be created to accommodate the required number of fields. Requirement and therefore this architecture is documented separately from PDF (XFA reference).ĮXAMPLE An invoice form may need to provide a variable number of invoice item fields ranging from 2 or 3 to hundreds or thousands. The fixed page model of PDF files designed to address use cases where dynamic forms are a strong The introduction of dynamically generated pages guided by schemas is a considerable departure from They are interacting with an XFA form that they are interacting with an XFA form. If an interactive processor supports XFA forms, that processor shall clearly indicate to the user when Schema (which is called a “template” in the XFA specification). Vary depending upon the quantity of entries, that can be accommodated through XFA’s use of a form The XML FormsĪrchitecture (XFA) was introduced in PDF 1.5 to address the need where the number of fields needs to Interactive forms (12.7), also called AcroForms, were introduced in PDF 1.2 and serve as a collection ofįields for gathering or presenting variable information interactively from the user.

The extract below is copied from PDF 2.0 specifications:
