PDFsharp-net6

PdfAcroForm

Namespace: PdfSharp.Pdf.AcroForms

Represents an interactive form (or AcroForm), a collection of fields for gathering information interactively from the user.

public sealed class PdfAcroForm : PdfSharp.Pdf.PdfDictionary, System.ICloneable, System.Collections.Generic.IEnumerable`1[[System.Collections.Generic.KeyValuePair`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[PdfSharp.Pdf.PdfItem, PdfSharp, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Collections.IEnumerable

Inheritance ObjectPdfItemPdfObjectPdfDictionaryPdfAcroForm
Implements ICloneable, IEnumerable<KeyValuePair<String, PdfItem>>, IEnumerable

Properties

Fields

Gets the fields collection (i.e. the root fields) of this of this AcroForm.
To retrieve all fields (including child-fields), use PdfAcroForm.GetAllFields()

public PdfAcroFieldCollection Fields { get; }

Property Value

PdfAcroFieldCollection

FieldRenderer

Gets the PdfAcroFieldRenderer used to render PdfAcroFields

public PdfAcroFieldRenderer FieldRenderer { get; }

Property Value

PdfAcroFieldRenderer

Elements

Gets the dictionary containing the elements of this dictionary.

public DictionaryElements Elements { get; }

Property Value

DictionaryElements

Stream

Gets or sets the PDF stream belonging to this dictionary. Returns null if the dictionary has no stream. To create the stream, call the CreateStream function.

public PdfStream Stream { get; set; }

Property Value

PdfStream

Owner

Gets the PdfDocument this object belongs to.

public PdfDocument Owner { get; }

Property Value

PdfDocument

IsIndirect

Indicates whether the object is an indirect object.

public bool IsIndirect { get; }

Property Value

Boolean

Internals

Gets the PdfInternals object of this document, that grants access to some internal structures which are not part of the public interface of PdfDocument.

public PdfObjectInternals Internals { get; }

Property Value

PdfObjectInternals

Reference

Gets the indirect reference of this object. If the value is null, this object is a direct object.

public PdfReference Reference { get; internal set; }

Property Value

PdfReference

ReferenceNotNull

Gets the indirect reference of this object. Throws if it is null.

public PdfReference ReferenceNotNull { get; }

Property Value

PdfReference

Exceptions

InvalidOperationException
The indirect reference must be not null here.

Methods

GetAllFields()

Gets the flattened field-hierarchy of this AcroForm

public IEnumerable<PdfAcroField> GetAllFields()

Returns

IEnumerable<PdfAcroField>

GetOrCreateResources()

Gets the PdfResources of this PdfAcroForm or creates a new one if none exist

internal PdfResources GetOrCreateResources()

Returns

PdfResources
The PdfResources of this AcroForm

PrepareForSave()

internal void PrepareForSave()

Flatten()

Flattens the AcroForm by rendering Field-contents directly onto the page

internal void Flatten()

AddTextField(Action<PdfTextField>)

Adds a new PdfTextField to the PdfAcroForm

public PdfTextField AddTextField(Action<PdfTextField> configure)

Parameters

configure Action<PdfTextField>
A method that receives the new PdfTextField for further customization

Returns

PdfTextField
The created and configured PdfTextField

Exceptions

ArgumentNullException

AddCheckBoxField(Action<PdfCheckBoxField>)

Adds a new PdfCheckBoxField to the PdfAcroForm

public PdfCheckBoxField AddCheckBoxField(Action<PdfCheckBoxField> configure)

Parameters

configure Action<PdfCheckBoxField>
A method that receives the new PdfCheckBoxField for further customization

Returns

PdfCheckBoxField
The created and configured PdfCheckBoxField

Exceptions

ArgumentNullException

AddRadioButtonField(Action<PdfRadioButtonField>)

Adds a new PdfRadioButtonField to the PdfAcroForm

public PdfRadioButtonField AddRadioButtonField(Action<PdfRadioButtonField> configure)

Parameters

configure Action<PdfRadioButtonField>
A method that receives the new PdfRadioButtonField for further customization

Returns

PdfRadioButtonField
The created and configured PdfRadioButtonField

Exceptions

ArgumentNullException

AddComboBoxField(Action<PdfComboBoxField>)

Adds a new PdfComboBoxField to the PdfAcroForm

public PdfComboBoxField AddComboBoxField(Action<PdfComboBoxField> configure)

Parameters

configure Action<PdfComboBoxField>
A method that receives the new PdfComboBoxField for further customization

Returns

PdfComboBoxField
The created and configured PdfComboBoxField

Exceptions

ArgumentNullException

AddListBoxField(Action<PdfListBoxField>)

Adds a new PdfListBoxField to the PdfAcroForm

public PdfListBoxField AddListBoxField(Action<PdfListBoxField> configure)

Parameters

configure Action<PdfListBoxField>
A method that receives the new PdfListBoxField for further customization

Returns

PdfListBoxField
The created and configured PdfListBoxField

Exceptions

ArgumentNullException

AddPushButtonField(Action<PdfPushButtonField>)

Adds a new PdfPushButtonField to the PdfAcroForm

public PdfPushButtonField AddPushButtonField(Action<PdfPushButtonField> configure)

Parameters

configure Action<PdfPushButtonField>
A method that receives the new PdfPushButtonField for further customization

Returns

PdfPushButtonField
The created and configured PdfPushButtonField

Exceptions

ArgumentNullException

AddSignatureField(Action<PdfSignatureField>)

Adds a new PdfSignatureField to the PdfAcroForm

public PdfSignatureField AddSignatureField(Action<PdfSignatureField> configure)

Parameters

configure Action<PdfSignatureField>
A method that receives the new PdfSignatureField for further customization

Returns

PdfSignatureField
The created and configured PdfSignatureField

Exceptions

ArgumentNullException

AddGenericField(Action<PdfGenericField>)

Adds a new PdfGenericField to the PdfAcroForm
Typically used as a container for other fields

public PdfGenericField AddGenericField(Action<PdfGenericField> configure)

Parameters

configure Action<PdfGenericField>
A method that receives the new PdfGenericField for further customization

Returns

PdfGenericField
The created and configured PdfGenericField

Exceptions

ArgumentNullException