This method adds an image to a PDF document.

[Visual Basic]
Public Function AddImage(ImageFile As String, x As Integer, y As Integer, width As Integer, height As Integer) As Boolean
Public Function AddImage(ImageData As Image, x As Integer, y As Integer, width As Integer, height As Integer) As Boolean
Public Function AddImage(ImageArray As Byte(), x As Integer, y As Integer, width As Integer, height As Integer) As Boolean
[C#]
public bool AddImage(String ImageFile, int x, int y, int width, int height);
public bool AddImage(Image ImageData, int x, int y, int width, int height);
public bool AddImage(Byte[] ImageArray, int x, int y, int width, int height);

Parameters

Parameter Name Explanation
ImageFilePath The image file that is to be added to the PDF
ImageData The image data
ImageArray The image data
x The horizontal position of the BOTTOM LEFT corner of the added image (in mm)
y The vertical position of the BOTTOM LEFT corner of the added image (in mm)
width The width of the image in mm (Note: This does not denote an x coordinate. It is the width of the image!)
height The height of the image in mm (Note: This does not denote an y coordinate. It is the height of the image!)

Return Value

Returns True if successful, otherwise returns False

Explanation

The AddImage method adds an image to a PDF document.

The image formats supported are BMP (1, 4, 8, and 24 bit) and JPEG.

The image specified by the SaveFileName property will be saved in pdf format.

The AddImage method should be used with the other PDF methods in the following order: Start, AddPage, AddImage, EndPage, and End.

Example

Also see the example on the Start method page.

AddImage method examples:

[Visual C#.NET]

//Loads an image file and creats a pdf
imageKit1.File.Pdf.AddImage("Image.jpg", 0, 0, 200, 200);

//Loads the image from file
Image img = Image.FromFile("Image.bmp");
//creats the pdf
imageKit1.File.Pdf.AddImage(img, 0, 0, 100, 100);

//Loads the image from file
imageKit1.File.FileName ="sample.jpg";
imageKit1.File.LoadImageFromFile(LoadFileType.Load);
//setts the image data into the imageKit1.File.RawData property
imageKit1.File.SaveImageToRawData(SaveFileType.SaveJPEG, imageKit1.Image);
//Creats the pdf
imageKit1.File.Pdf.AddImage(imageKit1.File.RawData, 0, 0, 100, 100);

Also See

ImageKit.File.Pdf Members | Newtone.ImageKit.Win.ImageKit

 

The ImageKit.NET3 is created by Newtone Corporation