GemBox.Pdf
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    PdfFormContent Class

    Namespace:
    GemBox.Pdf.Content
    Assembly:
    GemBox.Pdf.dll

    Represents a PDF content that is a self-contained description of any sequence of PdfContentElements.

    • C#
    • VB.NET
    public sealed class PdfFormContent : PdfVisualContentElement
    Public NotInheritable Class PdfFormContent
        Inherits PdfVisualContentElement
    Inheritance:
    System.Object
    PdfContentElement
    PdfVisualContentElement
    PdfFormContent

    Properties

    Bounds

    Gets the bounds of the PdfFormContent.

    • C#
    • VB.NET
    public override PdfQuad Bounds { get; }
    Public Overrides ReadOnly Property Bounds As PdfQuad
    Property Value
    PdfQuad

    The bounds of the PdfFormContent.

    Overrides
    PdfVisualContentElement.Bounds
    Remarks

    This member, although exposed as a property for easier debugging, performs complex calculations, so instead of accessing it frequently, cache its result instead.

    Content

    Gets the content of the associated Form subject to the Format of the current PdfFormContent.

    The returned PdfContent is editable, but editing it does not modify the Form's content. Instead, edited content is flattened to a PdfContentGroup as specified in the PDF Specification ISO 32000-1:2008, section '8.10 Form XObjects' when the Do operator is applied to a form XObject and documented in the Flatten(Boolean) method. This flattening occurs when committing the PdfContent, to which the PdfFormContent belongs, back to the underlying content stream or when cloning the PdfFormContent. To modify the Form's content, use its Content.

    note

    Methods BeginEdit(), EndEdit(Boolean), and CancelEdit() do not have any affect when called on a Content instance. To cancel editing of the PdfContent by discarding changes and rolling back to content specified in the Form's underlying content stream subject to the Format of the current PdfFormContent, set the Form property.

    • C#
    • VB.NET
    public PdfContent Content { get; }
    Public ReadOnly Property Content As PdfContent
    Property Value
    PdfContent

    The content of the Form subject to the Format of the current PdfFormContent.

    Remarks
    note

    If the associated Form is a group XObject then edited content is not flattened as described in the above summary, but the Form is cloned and the clone's content is set to this edited content. This makes sure that the group's behavior is maintained which is especially important for transparency group XObjects.

    If the associated Form is a transparency group XObject then the implicitly modified Format is used instead. Implicit modifications are: the blend mode initialized to Normal, the stroking and nonstroking alpha constants to 1.0, and the soft mask to None (see 11.6.6, "Transparency Group XObjects").

    See Also
    PDF Specification ISO 32000-1:2008, section '8.10 Form XObjects'

    ElementType

    Gets the Form value.

    • C#
    • VB.NET
    public override PdfContentElementType ElementType { get; }
    Public Overrides ReadOnly Property ElementType As PdfContentElementType
    Property Value
    PdfContentElementType

    The Form value.

    Overrides
    PdfContentElement.ElementType

    Form

    Gets the form or null if the content is a PostScript language fragment or sets the form.

    • C#
    • VB.NET
    public PdfForm Form { get; set; }
    Public Property Form As PdfForm
    Property Value
    PdfForm

    The form or null if the content is a PostScript language fragment.

    Remarks

    If PdfForm value that is being set is associated with another PdfDocument, this property setter will automatically clone it and associate the clone with the current PdfDocument.

    Exceptions
    System.ArgumentNullException

    Value is null.

    Methods

    Flatten(Boolean)

    Replaces the PdfFormContent in the PdfContentElementCollection with a PdfContentGroup that represents flattened representation of the PdfFormContent as specified in the PDF Specification ISO 32000-1:2008, section '8.10 Form XObjects' when the Do operator is applied to a form XObject.

    • C#
    • VB.NET
    public PdfContentGroup Flatten(bool recursive = false)
    Public Function Flatten(recursive As Boolean = False) As PdfContentGroup
    Parameters
    recursive
    System.Boolean

    If set to true then all the descendant PdfFormContent elements will also be flattened so that returned PdfContentGroup won't contain any descendant PdfFormContent element.

    Returns
    PdfContentGroup

    A PdfContentGroup that represents a flattened representation of the PdfFormContent and replaces it in the PdfContentElementCollection.

    Remarks

    A PdfContentGroup that represents a flattened representation of the PdfFormContent has the following properties and behavior:

    • The PdfContentGroup's Format is equal to the PdfFormContent's Format.
    • The PdfContentGroup's Transform is equal to the PdfFormContent's Transform.
    • The First element in the PdfContentGroup's Elements is a clipping PdfPathContent created from the Form's BoundingBox.
    • Transform of all elements contained in the PdfContentGroup's Elements is multiplied with the Form's Transform.

    After flattening, the Elements collection of the Content is empty. To roll back to content specified in the Form's underlying content stream subject to the Format of the current PdfFormContent, set the Form property.

    warning

    Flattening should not be done if the associated Form is a group XObject because the group's behavior is then lost which especially affects transparency group XObjects.

    Exceptions
    System.InvalidOperationException

    The PdfFormContent is not contained in any PdfContentElementCollection.

    See Also
    PDF Specification ISO 32000-1:2008, section '8.10 Form XObjects'

    Inherited Properties

    Collection

    Gets the PdfContentElementCollection that the PdfContentElement belongs to.

    (Inherited from PdfContentElement)

    Format

    Gets or sets the formatting properties applied to the PdfVisualContentElement.

    (Inherited from PdfVisualContentElement)

    Next

    Gets the next PdfContentElement in the Collection.

    (Inherited from PdfContentElement)

    Previous

    Gets the previous PdfContentElement in the Collection.

    (Inherited from PdfContentElement)

    Transform

    Gets or sets the transformation from the new (transformed) coordinate system to the original (untransformed) coordinate system.

    All coordinates used after the transformation are expressed in the transformed coordinate system.

    tip

    Before setting the Transform, move PdfVisualContentElement into its own PdfContentGroup so that the transformation is confined to that PdfContentGroup and doesn't have any effect on PdfContentElements outside that PdfContentGroup.

    (Inherited from PdfVisualContentElement)

    Examples

    Form XObjects example

    See Also

    PDF Specification ISO 32000-1:2008, section '8.10 Form XObjects'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.