Debenu Quick PDF logo


Image handling


Adds an image from a part of a file to the selected document.

For example, if many images have been concatenated into one file this function will allow the individual images to be extracted and added to the document.

Once an image has been added to the document it can be drawn on any page multiple times without further increasing the size of the PDF file.

Supported image file types are: BMP, TIFF, JPEG, PNG, GIF, WMF and EMF.

For BMP and TIFF images, the CompressImages function can called before calling this function to compress the image data. Other image types are automatically compressed.



function TDebenuPDFLibrary1511.AddImageFromFileOffset(FileName: WideString; Offset, 
  DataLength, Options: Integer): Integer;


Function DebenuPDFLibrary1511.PDFLibrary::AddImageFromFileOffset(FileName As String,
  Offset As Long, DataLength As Long, Options As Long) As Long


int DPLAddImageFromFileOffset(int InstanceID, wchar_t * FileName, int Offset,
  int DataLength, int Options)


FileName The name of the file containing the images.
Offset The offset into the file where the required image starts. The first byte in the file has an offset of 0.
DataLength The length of the image data in bytes
Options For multi-page TIFF images this parameter specifies the page number to load.
For PNG images:
0 = Load the image as usual
1 = Load the alpha channel as a greyscale image
2 = Load the image and alpha channel (limit alpha to 8-bit)
3 = Load the image (limit image 8-bit/channel)
4 = Load the alpha channel (limit to 8-bit/channel)
5 = Load the image with alpha channel (limit both to 8-bit/channel)
6 = Load the image and alpha channel
7 = Load the image and ICC color profile
For other image types this parameter should be set to 0.

Setting Options to -1 forces TIFF, EMF and WMF images to be loaded using the GDI+ graphics library. Multipage TIFF images can also be loaded using GDI+ by setting the Options parameter to -PageNumber (for example -3 for page 3).

Return values

0 The image could not be read from the file. This could indicate invalid image data or the file could not be found.
Non-zero The image was read from the file and successfully added to the document. The value returned is the ID of the image which can be used with the image drawing functions such as DrawImage.

Copyright © 2014 Debenu. All rights reserved. AboutContactBlogNewsletterSupport