 |
PdfFormManager Class |
Reads and fills the AcroForm fields of an existing PDF document. Load a document with one of
the
Load overloads, read or set values through
Fields, then persist the
changes with
Save(String) /
GetDocument.
Inheritance HierarchySystemObject
SelectPdf.UniversalPdfFormManager
Namespace: SelectPdf.UniversalAssembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntaxpublic class PdfFormManager
Public Class PdfFormManager
The PdfFormManager type exposes the following members.
Constructors| | Name | Description |
|---|
 | PdfFormManager |
Initializes a new instance of the PdfFormManager class. Call one of the
Load overloads before accessing Fields.
|
Top
Properties| | Name | Description |
|---|
  | CompactSave |
Gets or sets a value indicating whether the document is rewritten from scratch on save
instead of being updated incrementally. Default is false.
|
 | Fields |
Gets the collection of form fields in the loaded document. A document with no AcroForm -
which is the state a document is in after Flatten and a save - returns an
EMPTY collection, not null, so manager.Fields.Count is always safe to read.
|
 | Flatten | Gets or sets a value indicating whether the whole form is flattened on save. |
 | ReadOnly |
Gets or sets a value indicating whether the pdf form is read-only or not.
|
Top
Methods
RemarksFonts. A field is drawn in the font the form itself specifies. When that font
cannot encode the value — a form built for Latin text given Greek, Japanese or mathematical
symbols — a font that can is chosen from the ones installed on the machine, so the value is
visible and extractable rather than silently blank. If a character still does not appear,
no installed font covers it: installing one is the fix. The directories searched are
%SystemRoot%\Fonts on Windows, /Library/Fonts and ~/Library/Fonts on
macOS, and /usr/share/fonts, ~/.fonts and ~/.local/share/fonts on Linux.
It must be an outline font. A colour-bitmap face — Apple Color Emoji, Noto Color
Emoji — stores its glyphs as images rather than outlines, so it cannot be embedded in a PDF
and is skipped; a monochrome equivalent such as Noto Emoji works. One value is drawn in one
font, so a value mixing scripts that no single installed font covers keeps only the part that
font has.
ExamplePdfFormManager manager = new PdfFormManager();
manager.Load("form.pdf");
PdfFormFieldTextBox name =
manager.Fields["name"] as PdfFormFieldTextBox;
if (name != null) name.Text = "John Doe";
manager.Save("filled.pdf");
manager.Close();Dim manager As New PdfFormManager()
manager.Load("form.pdf")
Dim name As PdfFormFieldTextBox =
TryCast(manager.Fields("name"), PdfFormFieldTextBox)
If name IsNot Nothing Then name.Text = "John Doe"
manager.Save("filled.pdf")
manager.Close()
See Also