Loaded Image Extraction

Loaded image extraction lets applications enumerate image XObjects after LoadFromFile or LoadFromStream opens an existing PDF, inspect their metadata, and decode supported images into TBitmap instances

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