PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllInserts an image from a file into a PDF document and returns the index of the image.
|
| LONG AddImageFromFile ( BSTR fileName ) |
Parameters
fileName
Path to the image file.
Return value
New image index. If there is more then one image in a file then method returns index of a last added image. Supported image formats: BMP, GIF, JPEG, PNG, TIFF.
Remarks
This method will attempt to calculate image compression type automatically.
The return value is an image identifier in document's images collection and can be used in FlipImage, GetImageHeight, GetImageResolution, GetImageWidth, MakeImageGrayScale, MakeImageNegative, PlaceImageToCurrentPage, PDFPAGE_ShowImage.
Example
How to insert and show an image in PDF
Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
j := PDF.AddImageFromFile('chart.jpg');
PDF.PDFPAGE_ShowImage(j, 5, 5, 205, 155, 0);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
LONG j = PDF->AddImageFromFile("chart.jpg");
PDF->PDFPAGE_ShowImage(j, 5, 5, 205, 155, 0);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
long j = PDF.AddImageFromFile("chart.jpg");
PDF.PDFPAGE_ShowImage(j, 5, 5, 205, 155, 0);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
j = PDF.AddImageFromFile("chart.jpg")
PDF.PDFPAGE_ShowImage j, 5, 5, 205, 155, 0
PDF.EndDoc
See Also


