読み込み済み画像の抽出

読み込み済み画像の抽出機能により、LoadFromFile や LoadFromStream で既存の PDF を開いた後に image XObject を列挙し、メタデータを調べ、対応している画像を TBitmap インスタンスへデコードできます

主な API

対応ソース

デコードパラメーターと安全性

例

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;

関連 API