Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Images
AddImageFromBuffer

See Also Example
Collapse All

This method adds an image from a buffer into a PDF document's images collection and returns the index of the added image. Supported image formats: BMP, GIF, JPEG, PNG, TIFF.

Syntax

LONG AddImageFromBuffer (
LPSTR imageBuffer,
LONG bufferSizeInBytes
)
Parameters
imageBuffer
Data buffer containing an image

bufferSizeInBytes
Size (in bytes) of the image's data buffer

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

Remarks

The return value is an image identifier in the document's images collection and can be used in GetImageHeight, GetImageResolution, GetImageWidth, TransformImage, ShowImage, DrawImage.

Example

Adding an Image from a Buffer

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
{ imgBuffer is containing an image data }
{ from file, memory or else... }
{ imgSize - buffer size }
ind := PDF.AddImageFromBuffer(imgData, imgSize);
PDF.ShowImage(ind, 0, 0);
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
// char* imgBuffer is containing an image data
// from file, memory or else...
// imgSize - buffer size
long ind = PDF->AddImageFromBuffer(imgData, imgSize);
PDF->ShowImage(ind, 0, 0);
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
// char[] imgBuffer is containing an image data
// from file, memory or else...
// imgSize - buffer size
long ind = PDF.AddImageFromBuffer(imgData, imgSize);
PDF.ShowImage(ind, 0, 0);
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
' imgBuffer is containing an image data
' from file, memory or else...
' imgSize - buffer size
ind = PDF.AddImageFromBuffer(imgData, imgSize)
PDF.ShowImage ind, 0, 0
PDF.SaveToFile "test.pdf", True

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots