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

    Show / Hide Table of Contents

    PdfImageContent Class

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

    Represents a PDF content that is a rectangular array of sample values, each representing a color.

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

    Properties

    Bounds

    Gets the bounds of the PdfImageContent.

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

    The bounds of the PdfImageContent.

    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.

    ElementType

    Gets the Image value.

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

    The Image value.

    Overrides
    PdfContentElement.ElementType

    Image

    Gets or sets the image.

    If IsInline is true, the Image is made read-only. This is required to correctly detect content changes.

    If IsInline is true, use Clone() method on the Image to get PdfImage that you want to edit and set the edited clone back to the Image property.

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

    The image.

    Remarks

    If PdfImage 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.

    System.ArgumentException

    The specified image cannot be used as an inline image because either its stream dictionary has indirect descendants or it has stream filters that are not supported in inline images (JPXDecode or JBIG2Decode).

    IsInline

    Gets or sets a value indicating whether the image content is inlined in the content stream.

    If IsInline is true, the Image is made read-only. This is required to correctly detect content changes.

    • C#
    • VB.NET
    public bool IsInline { get; set; }
    Public Property IsInline As Boolean
    Property Value
    System.Boolean

    true if this image content is inlined in the content stream; otherwise, false.

    Exceptions
    System.ArgumentException

    Value is true and Image stream dictionary has indirect descendants or has stream filters that are not supported in inline images (JPXDecode or JBIG2Decode).

    Methods

    Save(Stream, ImageSaveOptions)

    Saves the image content in the specified stream.

    • C#
    • VB.NET
    public void Save(Stream stream, ImageSaveOptions options)
    Public Sub Save(stream As Stream, options As ImageSaveOptions)
    Parameters
    stream
    System.IO.Stream

    The stream in which to save the image content.

    options
    ImageSaveOptions

    The saving options which can be used to define settings for save operation.

    Save(String)

    Saves the image content to a file with the specified path. Path must include file extension.

    • C#
    • VB.NET
    public void Save(string path)
    Public Sub Save(path As String)
    Parameters
    path
    System.String

    The path to which to save the image content.

    Remarks

    File extension that is extracted from the path is used to create the appropriate ImageSaveOptions class instance that is then passed to the Save(String, ImageSaveOptions) method.

    Following file extensions are supported:

    • Portable Network Graphics: .png
    • Joint Photographic Experts Group: .jpeg, .jpg
    • Bitmap: .bmp
    • Tagged Image File Format: .tiff, .tif
    Exceptions
    System.ArgumentException

    If file extension is not specified or not supported. If file extension is not recognized, use Save(String, ImageSaveOptions) method overload instead.

    Save(String, ImageSaveOptions)

    Saves the image content to a file with the specified path.

    • C#
    • VB.NET
    public void Save(string path, ImageSaveOptions options)
    Public Sub Save(path As String, options As ImageSaveOptions)
    Parameters
    path
    System.String

    The path to which to save the image content.

    options
    ImageSaveOptions

    The saving options which can be used to define settings for save operation.

    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

    Export Images example

    See Also

    PDF Specification ISO 32000-1:2008, section '8.9 Images'
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.