PDFium Delphi Component Docs

SaveAsFlateRecompressed 메서드

컴포넌트: TPdf  ·  유닛: PDFium
문서를 다시 쓰면서 조건에 맞는 FlateDecode 스트림을 최대 압축으로 재인코딩하고, 측정된 바이트 절감이 호출자의 임계값을 넘을 때만 스트림을 교체합니다

Syntax

function SaveAsFlateRecompressed(Stream: TStream; const Options: TPdfFlateRecompressOptions; out Report: TPdfFlateRecompressReport; AllowSignedDocument: Boolean = False): Boolean;

function SaveAsFlateRecompressed(const FileName: string; const Options: TPdfFlateRecompressOptions; out Report: TPdfFlateRecompressReport; AllowSignedDocument: Boolean = False): Boolean;

Description

PDFium이 현재 메모리 상의 문서를 비증분 복사본으로 먼저 기록한 뒤, 래퍼가 SaveAsReachable과 정확히 같은 방식으로 문서 전체 도달성 조사를 수행합니다

도달 가능한 각 FlateDecode 스트림은 PdfInflate로 디코딩되고 DeflateCompress로 최대 압축하여 재인코딩됩니다. 측정된 절감이 MinSavingBytes와 MinSavingRatio를 모두 넘는 스트림만 교체됩니다

객체 번호와 세대가 안정적으로 유지되므로 재압축된 스트림 페이로드와 그 직접 /Length 값만 바뀌며, 살아남은 모든 교차 참조는 번호 재부여 없이 계속 유효합니다

출력은 단일 클래식 리비전이며 재구성된 트레일러는 /Root, /Info, /ID를 그대로 전달합니다

Policies and limits

Example

Options.MinSavingBytes:= 64;
Options.MinSavingRatio:= 0.1;
Pdf.SaveAsFlateRecompressed('recompressed.pdf', Options, Report);
WriteLn('recompressed ', Report.RecompressedCount, ' streams');

See Also

SaveAsReachable, SaveAsDeduplicated, SaveAs