AddImageFromBuffer
IPDFDocument3 :: General document methods

See Also Example
Collapse All

This method inserts an image from a memory buffer into a PDF document and returns the index of the image.

Syntax

LONG AddImageFromBuffer (
VARIANT* imageBuffer,
TxImageCompressionType compressionType
)
Parameters
imageBuffer
Image object (binary data) to insert

compressionType
Image compression type

Return value
This method returns the new image index. If there is more than one image in a buffer, then it returns the index of the most recently added image.

Remarks

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.

Equivalent in new interface: IPDFDocument4::AddImageFromBLOB.

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.AddImageFromBuffer(Buffer, itcJpeg);
PDF.PDFPAGE_ShowImage(j, 5, 5, 155, 85, 0);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
LONG j = PDF->AddImageFromBuffer(Buffer, itcJpeg);
PDF->PDFPAGE_ShowImage(j, 5, 5, 155, 85, 0);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
long j = PDF.AddImageFromBuffer(Buffer, TxImageCompressionType.itcJpeg);
PDF.PDFPAGE_ShowImage(j, 5, 5, 155, 85, 0);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
j = PDF.AddImageFromBuffer(Buffer, itcJpeg)
PDF.PDFPAGE_ShowImage j, 5, 5, 155, 85, 0
PDF.EndDoc

See Also

Reference