PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllThis method inserts an image from a file into a PDF document and returns the index of the image.
|
| LONG AddImageFromFilename ( BSTR fileName, TxImageCompressionType compressionType ) |
Parameters
fileName
Path to the image file
compressionType
Image compression type
Return value
This method returns the new image index. If there is more than one image in a file, then it returns the index of the most recently added image. compressionType helps to determine the type of image. Supported image formats: BMP, GIF, JPEG, PNG, TIFF.
Remarks
The return value is an image identifier in the document's images collection and can be used in FlipImage, GetImageHeight, GetImageResolution, GetImageWidth, MakeImageGrayScale, MakeImageNegative, PlaceImageToCurrentPage, PDFPAGE_ShowImage.
Equivalent in new interface: IPDFDocument4::AddImageFromFile.
Example
How to Insert and Show an Image in a PDF
Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
j := PDF.AddImageFromFileName('chart.jpg', itcJpeg);
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->AddImageFromFileName("chart.jpg", itcJpeg);
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.AddImageFromFileName("chart.jpg", TxImageCompressionType.itcJpeg);
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.AddImageFromFileName("chart.jpg", itcJpeg)
PDF.PDFPAGE_ShowImage j, 5, 5, 205, 155, 0
PDF.EndDoc
See Also


