Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfImage

    Show / Hide Table of Contents

    Class PdfImage

    Represents the base class for images.

    Inheritance
    System.Object
    PdfGraphicsElement
    PdfLayoutElement
    PdfShapeElement
    PdfImage
    PdfBitmap
    Inherited Members
    PdfShapeElement.GetBounds()
    PdfShapeElement.Layout(PdfLayoutParams)
    PdfLayoutElement.add_EndPageLayout(EndPageLayoutEventHandler)
    PdfLayoutElement.remove_EndPageLayout(EndPageLayoutEventHandler)
    PdfLayoutElement.add_BeginPageLayout(BeginPageLayoutEventHandler)
    PdfLayoutElement.remove_BeginPageLayout(BeginPageLayoutEventHandler)
    PdfLayoutElement.Draw(PdfPage, PointF)
    PdfLayoutElement.Draw(PdfPage, Single, Single)
    PdfLayoutElement.Draw(PdfPage, RectangleF)
    PdfLayoutElement.Draw(PdfPage, PointF, PdfLayoutFormat)
    PdfLayoutElement.Draw(PdfPage, Single, Single, PdfLayoutFormat)
    PdfLayoutElement.Draw(PdfPage, RectangleF, PdfLayoutFormat)
    PdfLayoutElement.Layout(HtmlToPdfLayoutParams)
    PdfLayoutElement.PdfTag
    PdfLayoutElement.EndPageLayout
    PdfLayoutElement.BeginPageLayout
    PdfGraphicsElement.Draw(PdfGraphics)
    PdfGraphicsElement.Draw(PdfGraphics, PointF)
    PdfGraphicsElement.Draw(PdfGraphics, Single, Single)
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public abstract class PdfImage : PdfShapeElement, IPdfWrapper

    Constructors

    PdfImage()

    Declaration
    protected PdfImage()

    Properties

    Height

    Declaration
    public int Height { get; }
    Property Value
    Type Description
    System.Int32

    HorizontalResolution

    Declaration
    public float HorizontalResolution { get; }
    Property Value
    Type Description
    System.Single

    Metadata

    Gets or sets Xmp metadata of the image.

    Declaration
    public XmpMetadata Metadata { get; set; }
    Property Value
    Type Description
    XmpMetadata
    Examples
    //Create a new PDF document.
    PdfDocument doc = new PdfDocument();
    //Add a page to the document.
    PdfPage page = doc.Pages.Add();
    //Create PDF graphics for the page
    PdfGraphics graphics = page.Graphics;
    //Load the image from the disk with enable metadata extraction.
    PdfBitmap image = new PdfBitmap(File.OpenRead("Autumn Leaves.jpg"), true);
    //Get image metadata
    XmpMetadata metadata = image.Metadata;
    //Create custom schema.
    CustomSchema customSchema = new CustomSchema(metadata, "custom", "http://www.syncfusion.com");
    customSchema["Author"] = "Syncfusion";
    customSchema["creationDate"] = DateTime.Now.ToString();
    customSchema["DOCID"] = "SYNCSAM001";
    //Set image metadata
    image.Metadata = metadata;
    //Draw the image
    graphics.DrawImage(image, 0, 0);
    //Save and close the document
    MemoryStream stream = new MemoryStream();
    doc.Save(stream);
    //Close the document.
    doc.Close(true);
    'Create a new PDF document.
    Dim doc As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = doc.Pages.Add()
    'Create PDF graphics for the page
    Dim graphics As PdfGraphics = page.Graphics
    'Load the image from the disk with enable metadata extraction.
    Dim image As New PdfBitmap(File.OpenRead("Autumn Leaves.jpg"), true)
    'Get image metadata
     Dim metadata As XmpMetadata = image.Metadata
     //Create custom schema.
     Dim customSchema As New CustomSchema(metadata, "custom", "http://www.syncfusion.com")
     customSchema("Author") = "Syncfusion"
     customSchema("creationDate") = DateTime.Now.ToString()
     customSchema("DOCID") = "SYNCSAM001"
     'Set image metadata
     image.Metadata = metadata
    'Draw the image
    graphics.DrawImage(image, 0, 0)
    'Save the document.
    Dim ms As New MemoryStream()
    doc.Save(stream)
    'Close the document.
    doc.Close(True)

    PhysicalDimension

    Declaration
    public virtual SizeF PhysicalDimension { get; }
    Property Value
    Type Description
    SizeF

    VerticalResolution

    Declaration
    public float VerticalResolution { get; }
    Property Value
    Type Description
    System.Single

    Width

    Declaration
    public int Width { get; }
    Property Value
    Type Description
    System.Int32

    Methods

    FromStream(Stream)

    Creates PdfImage from stream.

    Declaration
    public static PdfImage FromStream(Stream stream)
    Parameters
    Type Name Description
    System.IO.Stream stream

    The stream.

    Returns
    Type Description
    PdfImage

    Returns a created PdfImage object.

    GetPixelSize(Single, Single)

    Calculates the width and height of the image.

    Declaration
    protected static SizeF GetPixelSize(float width, float height)
    Parameters
    Type Name Description
    System.Single width

    Width of the image in points.

    System.Single height

    Height of the image in points.

    Returns
    Type Description
    SizeF

    Calculates the width and height of the image.

    GetPointSize(Single, Single)

    Calculates size of the image in points.

    Declaration
    protected SizeF GetPointSize(float width, float height)
    Parameters
    Type Name Description
    System.Single width

    Width in pixels.

    System.Single height

    Height in pixels.

    Returns
    Type Description
    SizeF

    size of the image in points.

    GetPointSize(Single, Single, Single, Single)

    Calculates size of the image in points.

    Declaration
    protected SizeF GetPointSize(float width, float height, float horizontalResolution, float verticalResolution)
    Parameters
    Type Name Description
    System.Single width

    Width in pixels.

    System.Single height

    Height in pixels.

    System.Single horizontalResolution

    Horizontal resolution.

    System.Single verticalResolution

    Vertical resolution.

    Returns
    Type Description
    SizeF

    size of the image in points.

    SetResolution(Single, Single)

    Sets resolution of the image.

    Declaration
    protected void SetResolution(float horizontalResolution, float verticalResolution)
    Parameters
    Type Name Description
    System.Single horizontalResolution

    Horizontal resolution of the image.

    System.Single verticalResolution

    Vertical resolution of the image.

    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved