THPDFPage.SetPageThumbnail / ClearPageThumbnail

THPDFPage

 

Supported Image Formats

附加或移除 page thumbnail image(PDF page /Thumb entry,ISO 32000-1 §12.3.4)。PDF viewers(Adobe Acrobat、Foxit、browser viewers)會在 navigation panel 中顯示參照的 image,而不需自行 rasterise page content,這會讓開啟 image-heavy archives 明顯更快

 

Delphi 語法:

ImageIndex 是先前 THotPDF.AddImage 或 THotPDF.AddImageFromFile call 傳回的值。底層 Image XObject 會依規格以 indirect reference 參照,因此同一 image 也可不衝突地繪製在一般頁面上。傳入 negative index 可移除既有 /Thumb entry

procedure ClearPageThumbnail;

 

Parameters

ImageIndex 是先前 THotPDF.AddImage 或 THotPDF.AddImageFromFile 呼叫傳回的 value。底層 Image XObject 會依 spec 以 indirect reference 方式引用,因此同一 image 也可在一般頁面上繪製而不衝突。傳入 negative index 可移除既有 /Thumb entry

 

說明

每個 PDF page 都可在其 /Thumb key 中帶有 Image XObject 的 indirect reference。該 image 通常是 downsampled 8-bit DeviceGray、DeviceRGB 或 Indexed bitmap(Acrobat 大約使用每個 page point 一個 thumbnail point),但 HotPDF 不驗證 color space,呼叫端可自行選擇要附加的內容。ClearPageThumbnail 會移除任何先前附加的 thumbnail。SetPageThumbnail(-1) 等同於 ClearPageThumbnail。傳入不在檔案 image list 範圍內的 ImageIndex 會擲回描述性例外

 

Example

PDF := THotPDF.Create(nil);
PDF.FileName := 'archive.pdf';
PDF.BeginDoc;
Idx := PDF.AddImageFromFile('preview.jpg', icJpeg);
PDF.CurrentPage.SetPageThumbnail(Idx);
PDF.EndDoc;

 

Availability

HotPDF v2.119.13. The PDF /Thumb entry is a PDF 1.0 feature and is not gated under PDF/A, PDF/X, or PDF/UA compliance modes. To make the viewer open with the thumbnail panel visible, also set THotPDF.PageMode := pmUseThumbs.

 

請參閱: Supported Image Formats, THPDFPage