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

    Show / Hide Table of Contents

    PdfContent Class

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

    Represents a PDF content.

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

    Methods

    BeginEdit()

    Begins editing of the PdfContent.

    Calling BeginEdit() is optional for Content and is mandatory for any other PdfContent that is going to be edited.

    Call EndEdit(Boolean) to commit the edited content and all resources (fonts, images, etc.) used by the edited content to the underlying content stream and the associated resource dictionary or CancelEdit() to discard the changes and roll back to content specified in the underlying content stream.

    If BeginEdit() is called on a PdfContent that is already being edited, the second and subsequent calls are ignored.

    • C#
    • VB.NET
    public void BeginEdit()
    Public Sub BeginEdit
    Remarks

    Calling BeginEdit() is optional for Content because GemBox.Pdf detects the first change to Content and implicitly calls BeginEdit() which sets the PdfPage as the current editing page of the PdfDocument.

    The PdfPage remains the current editing page of the PdfDocument until:

    • The EndEdit(Boolean) or CancelEdit() method is called on Content of the current editing page of the PdfDocument.
    • The Content of another PdfPage is edited, thus implicitly calling EndEdit(Boolean) on Content of the current editing page and BeginEdit() on Content of the newly edited page which sets it as the current editing page of the PdfDocument.
    • The GemBox.Pdf determines that content of the current editing page should be committed to the underlying content stream such as when saving a PdfDocument to a file or cloning a PdfDocument or a PdfPage.

    To override this behavior, call BeginEdit() method before and EndEdit(Boolean) method after editing the Content to take control of when the edited content is committed to the underlying content stream.

    Exceptions
    InvalidOperationException

    The content is not editable. To edit PdfForm's content, use Content property.

    CancelEdit()

    Cancels editing of the PdfContent by discarding changes since the last BeginEdit() call and rolling back to content specified in the underlying content stream.

    This method will be ignored if called on a PdfContent that is not being edited.

    • C#
    • VB.NET
    public void CancelEdit()
    Public Sub CancelEdit

    EndEdit(Boolean)

    Ends editing of the PdfContent by committing the edited content and all resources (fonts, images, etc.) used by the edited content to the underlying content stream and the associated resource dictionary.

    Calling EndEdit(Boolean) is optional for Content and is mandatory for any other PdfContent that is being edited.

    This method will be ignored if called on a PdfContent that is not being edited.

    • C#
    • VB.NET
    public void EndEdit(bool force = false)
    Public Sub EndEdit(force As Boolean = False)
    Parameters
    force
    Boolean

    If set to true, forces the committing of the, potentially unchanged, content and all resources (fonts, images, etc.) used by the content to the underlying content stream and the associated resource dictionary.

    ToString()

    Returns a Unicode text contained in this PdfContent.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    String

    A Unicode text contained in this PdfContent.

    Overrides
    PdfContentGroup.ToString()

    Inherited Properties

    Bounds

    Gets the upright bounds of the PdfContentGroup.

    (Inherited from PdfContentGroup)

    Collection

    Gets the PdfContentElementCollection that the PdfContentElement belongs to.

    (Inherited from PdfContentElement)

    ElementType

    Gets the Group value.

    (Inherited from PdfContentGroup)

    Elements

    Gets the content elements such as text, paths and external objects (images and forms) contained directly in this group.

    (Inherited from PdfContentGroup)

    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)

    Inherited Methods

    DrawAnnotation(PdfAnnotation)

    Draws the annotation.

    (Inherited from PdfContentGroup)

    DrawAnnotation(PdfAnnotation, PdfMatrix)

    Draws the annotation with the specified transformation.

    (Inherited from PdfContentGroup)

    DrawImage(PdfImage, PdfMatrix)

    Draws image with the specified transformation.

    (Inherited from PdfContentGroup)

    DrawImage(PdfImage, PdfPoint)

    Draws image at the specified location.

    (Inherited from PdfContentGroup)

    DrawImage(PdfImage, PdfPoint, PdfSize)

    Draws image at the specified location and of the specified size.

    (Inherited from PdfContentGroup)

    DrawText(PdfFormattedText, PdfMatrix)

    Draws formatted text with the specified transformation.

    (Inherited from PdfContentGroup)

    DrawText(PdfFormattedText, PdfPoint)

    Draws formatted text at the specified location.

    (Inherited from PdfContentGroup)

    DrawText(PdfFormattedTextLine, PdfPoint)

    Draws formatted text line at the specified location.

    (Inherited from PdfContentGroup)

    Examples

    Content Streams and Resources example
    Reading example

    See Also

    PDF Specification ISO 32000-1:2008, section '7.8 Content Streams and Resources'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.