Class PdfFormFiller

Namespace
SoftZenPdf
Assembly
SoftZenPdf.dll

Fills the interactive form of an existing PDF. Changes are appended as an incremental update, so the original bytes are kept unchanged, and new appearance streams are generated so filled values show in every viewer.

public sealed class PdfFormFiller
Inheritance
PdfFormFiller
Inherited Members

Examples

var filler = PdfFormFiller.Open("form.pdf");
filler.SetValue("Name", "Jane Doe");
filler.SetChecked("Subscribe", true);
filler.Save("form-filled.pdf");

Remarks

Generated appearances use a standard 14 font (the field's own font if it is one, otherwise Helvetica), so filled text is limited to WinAnsiEncoding (Latin) characters; any substitution is reported in Warnings. Files that needed repair to open cannot be filled in place; merge them into a new document first.

Properties

Fields

The form's fields with their current values, as they were in the original file.

Warnings

Notes about font substitutions made while generating appearances.

Methods

FromBytes(byte[], string?)

Opens a PDF form held in memory for filling.

FromStream(Stream, string?)

Opens a PDF form from a stream for filling. The stream is read from its current position to the end and left open.

Open(string, string?)

Opens a PDF form for filling.

Save(Stream)

Writes the original file followed by the incremental update to a stream. The stream is not closed.

Save(string)

Writes the original file followed by the incremental update to a new file.

SetChecked(string, bool)

Ticks or clears a check box.

SetValue(string, string)

Sets a field's value: the text of a text field, the chosen export value of a dropdown, list box or radio group, or the state of a check box (Off, false or empty clears it; anything else ticks it).

ToArray()

Returns the filled PDF as a byte array.