This method adds an image to a PDF document.

[Visual Basic]
Public Function AddImage(ImageFile As String, x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer) As Boolean
Public Function AddImage(ImageData As Image, x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer) As Boolean
Public Function AddImage(ImageArray As Byte(), x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer) As Boolean
[C#]
public bool AddImage(String ImageFile, int x1, int y1, int x2, int y2);
public bool AddImage(Image ImageData, int x1, int y1, int x2, int y2);
public bool AddImage(Byte[] ImageArray, int x1, int y1, int x2, int y2);

Parameters

Parameter Name Explanation
ImageFilePath The image file that is to be added to the PDF
ImageData The image data
ImageArray The image data
x1 The horizontal position of the BOTTOM LEFT corner of the added image (in mm)
y1 The vertical position of the BOTTOM LEFT corner of the added image (in mm)
x2 The width of the image in mm (Note: This does not denote an x coordinate. It is the width of the image!)
y2 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 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.NET2 is created by Newtone Corporation