Loaded Image Extraction

로드 이미지 추출은 LoadFromFile이나 LoadFromStream이 기존 PDF를 연 뒤 image XObject를 열거하고, 메타데이터를 검사하고, 지원 이미지를 TBitmap 인스턴스로 디코딩하게 합니다

Main APIs

Supported sources

디코드 파라미터와 안전

예제

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