Image
Represents an image.
public class Image : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class Image
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: ObjectPageElementTaggablePageElementRotatingPageElementImage
Implements: IArea, ICoordinate, ISerializable
Licensing Info
Basic usage ot this class is a DynamicPDF Core Suite Essentials feature. However, some properties or methods require full licensing and are noted accordingly. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF Core Suite for .NET v12.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
Examples
The following example will place an image on the page.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create an image
Dim MyImage As Image = New Image("C:\MyImage.jpg", 0, 0)
' Add the image to the page
MyPage.Elements.Add(MyImage)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath, string imagePath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create an image
Image image = new Image(imagePath, 0, 0);
// Add the image to the page
page.Elements.Add(image);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to place images on a page. If an image will be used more than once, please see the Image Reuse topic.
Constructors
Image(Byte[], Single, Single, Single?) | Initializes a new instance of the Image class. |
Image(ImageData, Single, Single) | Initializes a new instance of the Image class. |
Image(ImageData, Single, Single, Single) | Initializes a new instance of the Image class. |
Image(Stream, Single, Single, Single) | Initializes a new instance of the Image class. |
Image(String, Single, Single) | Initializes a new instance of the Image class. |
Image(String, Single, Single, Single) | Initializes a new instance of the Image class. |
Properties
Align | Gets or sets the Align enumeration that specifies horizontal alignment of the image on the X coordinate. |
AlternateText | Gets or sets the alternate text of the image. |
Angle | Gets or sets the heights of the angle element. (Inherited from RotatingPageElement) |
Height | Gets or sets the height of the image. |
HorizontalDpi | Gets or sets the horizontal dpi (also known as pixels per inch) of the image. |
ID | Gets or sets the ID of the page element. (Inherited from PageElement) |
IgnoreMargins | Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement) |
ImageData | Get the image's ImageData object. |
RelativeTo | Gets and sets placement of the page element on the page. (Inherited from PageElement) |
ScaleX | Gets or sets the horizontal scale of the image. |
ScaleY | Gets or sets the vertical scale of the image. |
Tag | Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement) |
TagOrder | Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement) |
VAlign | Gets or sets the VAlign enumeration that specifies vertical alignment of the image on the Y coordinate. |
VerticalDpi | Gets or sets the vertical dpi (also known as pixels per inch) of the image. |
Width | Gets or sets the width of the image. |
X | Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement) |
Y | Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement) |
Methods
Draw(PageWriter) | Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement) |
Equals(Object) | Determines whether the specified Object is equal to the current Object . (Inherited from Object) |
GetHashCode() | Serves as a hash function for a particular type. (Inherited from Object) |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
SetBounds(Single, Single) | Scales the image to fit in the given box keeping the X and Y scale equal. |
SetDpi(Single) | Scales the image to have the specified dpi (also known as pixels per inch). |
SetDpi(Single, Single) | Scales the image to have the specified dpi (also known as pixels per inch). |
SetSize(Single, Single) | Scales the image to fit the exact width and height given. |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |