THotPDF.UseObjectStreams Property

 

THotPDF.UseObjectStreams

THotPDF

 

傳回頂部  上一頁  下一頁

將符合條件的間接物件打包進 PDF 1.5 的 /Type /ObjStm 容器 stream(ISO 32000-1 7.5.7),以縮減磁碟上的 PDF 大小

 

Delphi 語法:

property UseObjectStreams: Boolean;

 

C++ 語法:

__property bool UseObjectStreams;

 

說明

當 UseObjectStreams 為 true(且 UseXRefStream 也為 true)時,EndDoc 會依 ISO 32000-1 7.5.7,將每個符合資格的 indirect object(dictionaries、arrays、numbers、names、strings、booleans、nulls)封裝到一個或多個 /Type /ObjStm container streams 中。cross-reference stream 接著會透過 type-2 entries(host ObjStm object number + 該 stream 內的 entry index)參照封裝後的 objects,因此會消除個別 N G obj ... endobj framing bytes 與每列 textual xref entries

 

它會與 UseXRefStream property 自然搭配,形成最精簡的 PDF 1.5+ writer pipeline。ObjStm packer 會讓 stream objects、encryption dictionary,以及 trailer 指向的 Catalog 與 Info dictionaries 保持未壓縮,因此即使是最小化 PDF parsers 仍能定位 document roots 並解密內容

 

Default value: false (opt-in).

當 UseXRefStream 關閉(依規格,type-2 entries 無法以 textual xref table 表示),或 Version 低於 PDF 1.5 時,將 UseObjectStreams 設為 true 會在儲存時靜默降級為 false

 

在 PDF/A-1 下也會被強制關閉:ISO 19005-1(PDF 1.4,clause 6.1.4)禁止 compressed object streams 與其依附的 cross-reference streams,因此只要 PDFACompliance 指定 part-1 level,EndDoc 就會輸出 classic xref table;PDF/A-2 與 PDF/A-3(PDF 1.7)則仍可使用

 

Code Example

HPDF := THotPDF.Create( nil );
try
  HPDF.FileName := 'c:\Output.pdf';
  HPDF.Version := pdf15;          // Object streams require PDF 1.5+
  HPDF.UseXRefStream := true;     // ObjStm references need a /Type /XRef stream
  HPDF.UseObjectStreams := true;  // Pack indirect objects into /Type /ObjStm
  HPDF.Compression := cmFlateDecode;
  HPDF.BeginDoc;
  HPDF.CurrentPage.TextOut( 100, 100, 0, 'Compact PDF 1.5 output' );
  HPDF.EndDoc;
finally
  HPDF.Free;
end;

 

Size reduction

對於以小型 indirect dictionaries 為主的檔案(多頁檔案、註解、AcroForm widgets、structure-tree elements、Optional Content layers),節省量通常為 post-FlateDecode 檔案大小的 20-40%。一份 30 頁純圖形 smoke test 會從 14502 bytes 縮小到 8488 bytes(-41.5%)

 

請參閱

UseXRefStream, Compression, Version, PDF 篩選器支援