Loaded Image Extraction

Once LoadFromFile or LoadFromStream has opened an existing PDF, loaded image extraction lets your application enumerate the image XObjects embedded in it, inspect their metadata, and decode the supported ones into TBitmap instances ready for previewing, transcoding or re-embedding

Main APIs

Supported sources

Decode parameters and safety

Example

var
  Doc: THotPDF;
  Info: THPDFLoadedImageInfo;
  Bmp: TBitmap;
  I: Integer;
begin
  Doc := THotPDF.Create(nil);
  try
    Doc.LoadFromFile('input.pdf');
    for I := 0 to Doc.GetLoadedImageCount - 1 do
      if Doc.GetLoadedImageInfo(I, Info) and Info.Decodable then
      begin
        Bmp := Doc.ExtractLoadedImage(I);
        try
          if Assigned(Bmp) then
            Bmp.SaveToFile(Format('image-%d.bmp', [I]));
        finally
          Bmp.Free;
        end;
      end;
  finally
    Doc.Free;
  end;
end;

Related APIs