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

    Show / Hide Table of Contents

    PdfVisualContentElement Class

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

    Represents a base class for a PDF content element that has a visual representation.

    • C#
    • VB.NET
    public abstract class PdfVisualContentElement : PdfContentElement
    Public MustInherit Class PdfVisualContentElement
        Inherits PdfContentElement
    Inheritance:
    System.Object
    PdfContentElement
    PdfVisualContentElement
    Derived
    PdfContentGroup
    PdfFormContent
    PdfImageContent
    PdfPathContent
    PdfShadingContent
    PdfTextContent

    Properties

    Bounds

    Gets the bounds of the PdfVisualContentElement.

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

    The bounds of the PdfVisualContentElement.

    Remarks

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

    Format

    Gets or sets the formatting properties applied to the PdfVisualContentElement.

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

    The formatting properties applied to the PdfVisualContentElement.

    Remarks

    This property always returns a new instance of a PdfContentFormat that points to data associated with this PdfVisualContentElement. This reduces memory footprint since simpler internal structures can be used to hold the data and execution time increase is negligible since Garbage Collector has a very good performance for a short-lived (Generation 0) objects.

    When setting a value, instance of a PdfContentFormat won't actually be stored in this PdfVisualContentElement, but the data to which the instance points to will be copied. This enables easy copying of a set of formatting properties from one PdfVisualContentElement to another.

    Also, when setting a value on a PdfTextContent, the actual font and size (retrieved with GetFont(out Double) method) remain unchanged because new font might not contain all the necessary information to correctly position, render and/or convert to Unicode all characters of the PdfTextContent. As a workaround, set font and size directly by using SetFont(PdfBasicFont, Double) method.

    If value that is being set comes from a PdfVisualContentElement that is contained in another PdfDocument, this property setter will automatically clone all PdfContentResources (PdfBasicFonts, PdfPatterns, PdfShadings, and PdfColorSpaces) contained in the PdfContentFormat and associate the clones with the current PdfDocument.

    See Also
    PDF Specification ISO 32000-1:2008, section '8.4 Graphics State'

    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.

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

    The transformation from the new (transformed) coordinate system to the original (untransformed) coordinate system.

    Inherited Properties

    Collection

    Gets the PdfContentElementCollection that the PdfContentElement belongs to.

    (Inherited from PdfContentElement)

    ElementType

    Gets the type of the PDF content element.

    (Inherited from PdfContentElement)

    Next

    Gets the next PdfContentElement in the Collection.

    (Inherited from PdfContentElement)

    Previous

    Gets the previous PdfContentElement in the Collection.

    (Inherited from PdfContentElement)

    Examples

    Content Formatting example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.