SaveImageListItemNativeDataToFile

Images

Description

Writes one image-list item's original still-encoded PDF stream bytes to a file without decoding or re-encoding them

Syntax

Delphi

Function SaveImageListItemNativeDataToFile(ImageListID, ImageIndex: Integer; Const ImageFileName: WideString): Integer;

Parameters

ImageListIDImage-list handle returned by GetPageImageList or another image enumeration
ImageIndexOne-based item index within the list
ImageFileNameDestination file path; an existing file is replaced, and an empty native payload writes nothing

Return values

0No file was written successfully
1The native stream bytes were written

Failure behaviour

Returns 0 when the image-list handle or 1-based item index is invalid, the native stream is empty, or the output file cannot be created or written. File-system exceptions are caught and reported as 0

Remarks

An existing output file is replaced. Use GetImageListItemNativeFormat to choose a suitable extension. The saved bytes remain encoded exactly as stored in the image XObject, so flate data is not a ready-to-display bitmap and an unknown chain may need additional PDF filters

Example

if PDF.GetImageListItemNativeFormat(ListID, 1)= 'jpeg' then
  Saved:= PDF.SaveImageListItemNativeDataToFile(ListID, 1, 'image1.jpg');

See also

GetImageListItemNativeDataToString, GetImageListItemNativeFormat, SaveImageListItemDataToFile