ImageEn, unit iexPdfiumCore

TPdfObject.GetImageRaw

TPdfObject.GetImageRaw


Declaration

function GetImageRaw(const Dest: TFilename; Decode: Boolean = False): Boolean; overload;
function GetImageRaw(Dest: TStream; Decode: Boolean = False): Boolean; overload;
function GetImageRaw(Dest: TIEBitmap; Decode: Boolean = False): Boolean; overload;


Description

Returns the raw stream of an image within the current page to a file, stream or TIEBitmap.
If Decode = False, this method will get the raw image data as stored in the PDF without applying any filters.
If Decode = True, it will get the decoded image data (uncompressed image data), which is the raw image data after having all filters applied.

Note:
The raw format will return an image with an undetermined compression and type
The TIEBitmap overload will fail if the image cannot be loaded
Use GetImage to reliably return the image of an object


Example

// Show preview of an image in the current PDF page
if objType = ptImage then
begin
  bmp := TIEBitmap.Create();

  // Try raw if possible
  haveBMP := ImageEnView1.PdfViewer.Objects[idx].GetImageRaw( bmp );

  // Fall-back to bitmap
  if not haveBMP then
    haveBMP := ImageEnView1.PdfViewer.Objects[idx].GetImage( bmp );

  if haveBMP then
  begin
    ImageEnView2.Assign( bmp );
    ImageEnView2.Fit( False );
  end;
  bmp.Free();
end;


See Also

GetImage
SetImage