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

    Show / Hide Table of Contents

    PdfContentFormat Class

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

    Represents a group of formatting properties applied to a PDF content.

    • C#
    • VB.NET
    public sealed class PdfContentFormat
    Public NotInheritable Class PdfContentFormat
    Inheritance:
    System.Object
    PdfContentFormat

    Properties

    Clip

    Gets or sets the formatting properties related to clipping an area.

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

    The formatting properties related to clipping an area.

    Remarks

    The Clip is always applicable to PdfFormContent, is applicable to PdfTextContent and PdfPathContent if IsApplied is true, and is not applicable to any other PdfVisualContentElement.

    If the Clip is not applicable, then clip-related graphics state parameters won't be written when writing the associated PdfVisualContentElement to the underlying content stream.

    Fill

    Gets or sets the formatting properties related to painting an area (filling).

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

    The formatting properties related to painting an area (filling).

    Remarks

    When setting a value, instance of a PdfFillFormat won't actually be stored in the associated 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.

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

    The Fill is always applicable to PdfFormContent, is applicable to PdfTextContent and PdfPathContent if IsApplied is true, and is not applicable to any other PdfVisualContentElement. The Opacity is, additionally, applicable to PdfImageContent and PdfShadingContent.

    If the Fill is not applicable, then fill-related graphics state parameters won't be written when writing the associated PdfVisualContentElement to the underlying content stream.

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

    Stroke

    Gets or sets the formatting properties related to drawing a line (stroking).

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

    The formatting properties related to drawing a line (stroking).

    Remarks

    When setting a value, instance of a PdfStrokeFormat won't actually be stored in the associated 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.

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

    The Stroke is always applicable to PdfFormContent, is applicable to PdfTextContent and PdfPathContent if IsApplied is true, and is not applicable to any other PdfVisualContentElement.

    If the Stroke is not applicable, then stroke-related graphics state parameters won't be written when writing the associated PdfVisualContentElement to the underlying content stream.

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

    Text

    Gets or sets the text-related formatting properties.

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

    The text-related formatting properties.

    Remarks

    When setting a value, instance of a PdfTextFormat won't actually be stored in the associated 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) contained in the PdfTextFormat and associate the clones with the current PdfDocument.

    The Text is applicable to PdfTextContent and PdfFormContent, and is not applicable to any other PdfVisualContentElement.

    If the Text is not applicable, then text-related graphics state parameters won't be written when writing the associated PdfVisualContentElement to the underlying content stream.

    Extension Methods

    PdfContentExtensions.TryGetValue(PdfContentFormat, PdfName, out PdfBasicObject)
    PdfContentExtensions.SetValue(PdfContentFormat, PdfName, PdfBasicObject)

    Examples

    Content Formatting example
    Clipping example
    Filling example
    Stroking example

    See Also

    PDF Specification ISO 32000-1:2008, section '8.4 Graphics State'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.