PDF 篩選器支援

總覽

PDF streams 與嵌入影像會透過 filter 名稱標示其編碼方式。HotPDF 在產生檔案或解碼外部內容時,主要使用下列 filter 家族

常見 filter

  • FlateDecode:產生 streams 時的主要壓縮 filter,也是以 zlib 為基礎的主要解壓縮路徑
  • LZWDecode:透過 HPDFLZW.pas 支援舊版與相容性情境
  • DCTDecode: 用於 HotPDF 影像載入路徑處理的標準 JPEG 影像資料
  • CCITTFaxDecode: 常見於單色 TIFF 與傳真式影像資料
  • ASCIIHexDecode / ASCII85Decode / RunLengthDecode:自 HotPDF v2.4.0 起在 HPDFTypes.pas 公開的 encoder helpers(_ASCIIHexEncode、_ASCII85Encode、_RunLengthEncode)。在需要將任意二進位內容包裝給 7-bit 通道,或需要明確支援 PDF 1.7 7.4 round-trip 時很有用_ASCIIHexEncode、_ASCII85Encode、_RunLengthEncode) 自 HotPDF v2.4.0 起提供。將任意二進位內容包裝給 7-bit 通道,或需要明確的 PDF 1.7 7.4 往返支援時很有用
  • JBIG2Decode / JPXDecode:PDF 1.7 7.4.7 / 7.4.9 定義的 filter 名稱。HotPDF 隨附的 JBIG2 與 JPEG 2000 helpers 目前是 stubs,在連結真正的 OpenJPEG / JBIG2 backend 前會回報不支援(return False)。較早的 builds 會回傳假的 100×100 成功結果並產生無法讀取的影像;這點現在已修正

實務備註

  • 並非每個 filter 都透過單一通用 API 提供;有些是透過專用的影像或串流輔助單元存取
  • 對產生的 PDF 內容而言,THotPDF.Compression 仍是主要的使用者可見設定
  • 載入外部資料時,適用的 filter 取決於來源檔案格式與正在使用的 helper class
  • 加密 PDF 會將這些 filters 與 security handler 搭配使用;支援的 AES‑128(V=4 R=4 / CFM=AESV2)與 RC4(V=1/V=2)選項請參閱 CryptKeyLength
  • 保留的 crypt-filter 政策可透過 ConfigureCryptFilterDefaults 分別為字串、一般串流與內嵌檔案串流選定。密碼安全接受 StdCF 或 Identity,公鑰安全接受 DefaultCryptFilter 或 Identity。SetStreamCryptFilter 會加入或清除明確的前導 Crypt filter,而不擾動既有的解碼管線。逐串流覆寫需要加密字典 /V 4 以上
  • 加密 payload 包裝 會讓一般頁面串流維持可見,同時透過 EFOpen crypt filter 保護內嵌檔案的 metadata 與 bytes;自 HotPDF v2.715.0 起提供明確的已載入文件檢查與解鎖 API
  • 受密碼保護的附件串流使用 /EFF;只要 /EFF 與 /StmF 不同,就會加上明確的 Crypt filter。以公鑰加密的明確串流 filter 會 fail closed,因為它們需要串流專屬的 recipient envelope
  • 已載入文件會公開原始的 /CF、/StrF、/StmF 與 /EFF 政策,包含區分大小寫的外部具名 filter、明確或省略的 /CFM /None、驗證事件,以及透過 THPDFCryptFilterInfo 取得的有效金鑰長度。Standard-handler V2 filter 長度以 bytes 讀取,public-key V2 filter 長度以 bits 讀取,且只接受 40-bit 與 128-bit 的 V2 金鑰。明文 object-stream 容器仍會透過 /StrF 解密打包的成員字串,加密容器則避免第二次成員解密。增量更新會保留已載入的政策。自 HotPDF v2.675.0 起提供
  • 互動式表單欄位會輸出成由檢視器繪製的 widget 標註;參閱 AcroForm 支援
  • 文字標記標註(Highlight、Underline、Squiggly、StrikeOut)與文件內跳轉連結(GoTo、GoToR、Launch)自 HotPDF v2.6.0 起以新的 THPDFPage.Add*Annotation / AddGoToLink / AddGoToRLink / AddLaunchLink 方法提供
  • DeviceCMYK 輸出可透過 THPDFPage.SetCMYKColor / SetCMYKFillColor / SetCMYKStrokeColor 使用;自 HotPDF v2.7.0 起,ICC-managed color spaces 透過 THotPDF.RegisterICCProfile 註冊,並經由 SetFillColorSpace / SetStrokeColorSpace + SetFillColor / SetStrokeColor 套用
  • 儲存前將 THotPDF.UseXRefStream 設為 true,即可輸出單一 /Type /XRef、以 FlateDecode 壓縮的 cross-reference stream,而不是文字形式的 xref / trailer / startxref 序列(PDF 1.7 7.5.8);自 HotPDF v2.8.0 起提供
  • 將 THotPDF.EnableXMPMetadata 設為 true,即可將 XMP /Type /Metadata /Subtype /XML stream 附加到 Catalog(PDF 1.7 14.3.2);內容可由 Info dict 欄位自動建立,也可透過 CustomXMP 提供手寫 packet。自 HotPDF v2.9.0 起提供
  • 逐方法 PDF 版本閘控(自 HotPDF v2.24.0 起)。v2.4.0+ 引入的每個功能方法在輸出前都會查詢 RequirePDFVersion;StrictVersionLock=false(預設值)時,檔案 Version 會自動提高到該功能所需的最低版本;StrictVersionLock=true 時,該呼叫會被拒絕,讓儲存的檔案嚴格符合所選 1.3 / 1.4 / 1.5 / 1.6 / 1.7 reference spec
  • 用於 FlateDecode 壓縮影像資料的 PNG 與 TIFF predictor encoders(PDF 1.7 7.4.4.4):_PNGPredictorEncode 套用 libpng minimum-absolute-difference filter heuristic(Predictor=15),_TIFFPredictor2Encode 套用 horizontal differencing(Predictor=2)。自 HotPDF v2.10.0 起提供
  • Tagged PDF 進入點(PDF 1.7 14.7-14.8):THotPDF.Lang 填入 Catalog 裡的 /Lang;EnableTaggedPDF 輸出 /MarkInfo <</Marked true>> 與 stub 的 /StructTreeRoot;新的 THPDFPage.BeginMarkedContent / BeginMarkedContentMCID / EndMarkedContent 方法負責寫出 BMC / BDC / EMC 內容串流運算子。自 HotPDF v2.11.0 起提供
  • 軸向與放射狀漸層(PDF 1.7 7.10 / 8.7):THotPDF.RegisterAxialGradient / RegisterRadialGradient 會建立完整的 Function Type 2 / Shading Type 2-3 / Pattern Type 2 堆疊,並傳回穩定的 pattern 名稱;再用 THPDFPage.SetFillPattern / SetStrokePattern 套用到頁面。起訖顏色的 component 數決定選用 DeviceGray (1) / DeviceRGB (3) / DeviceCMYK (4)。自 HotPDF v2.13.0 起提供;Function Type 3 多站點漸層自 v2.18.0 起由 RegisterMultiStopAxialGradient 提供,徑向版本自 v2.686.0 起由 RegisterMultiStopRadialGradient 提供
  • Inline images(PDF 1.7 8.9.7)透過 THPDFPage.DrawInlineImage 輸出;未提供 Filter 時,raw bytes 會自動以 ASCIIHex 包裝,讓 content stream 保持 7-bit-clean。自 HotPDF v2.18.0 起提供
  • OutputIntents(PDF 1.7 14.11)透過 THotPDF.AddOutputIntent 建立;每次呼叫都會將 /Type /OutputIntent dict 附加到 Catalog,並可選擇以 /DestOutputProfile 參照已註冊的 ICC profile。自 HotPDF v2.18.0 起提供
  • AcroForm appearance-stream 自動產生(PDF 1.7 12.5.5 / 12.7.3.3 / 8.10):HotPDF 會為每個 widget 的 /AP /N entry 預先建立 /Subtype /Form Form XObject(按鈕會建立 Yes / Off sub-dicts),在 AcroForm /DR default resources 中填入 Helvetica / ZapfDingbats indirect font dicts,同時 /NeedAppearances 維持 true,檢視器仍可依 /DA 重建外觀。加入互動式表單欄位前將 THotPDF.AutoFormAppearances 設為 true 還會把 /NeedAppearances 切換為 false,讓 renderers 採用內嵌 streams;設為 false 則完全不寫 /AP。自 HotPDF v2.28.0 起提供,自 v2.1203.21 起預設開啟
  • ViewerPreferences /ViewArea 與 /ViewClip(PDF 1.4 12.2 Table 152)現在可透過 THotPDF.ViewArea / THotPDF.ViewClip 屬性使用(並對應 vpViewArea / vpViewClip set 成員)。兩者都接受 THPDFPageBoundary 值(MediaBox / CropBox / BleedBox / TrimBox / ArtBox),補齊 HotPDF 對四種 PDF 1.4 頁面邊界 ViewerPreferences 的支援。自 HotPDF v2.29.0 起提供
  • 頁面轉場(PDF 1.1 / 1.5 12.4.4):THPDFPage.SetPageTransition 會在頁面寫入 /Trans 字典,讓處於 /PageMode /FullScreen 的 PDF 閱讀器在翻頁時播放動畫。PDF 1.1 樣式(Split、Blinds、Box、Wipe、Dissolve、Glitter、R)與 PDF 1.5 樣式(Fly、Push、Cover、Uncover、Fade)透過 THPDFTransitionStyle 列舉公開;/Dm、/M 與 /Di 等附屬子選項也一併公開。THPDFPage.SetPageDuration 會寫入以秒計的 /Dur 自動前進延遲。自 HotPDF v2.30.0 起提供
  • 頁面層級透明度群組(PDF 1.4 11.6.6 / 7.5.5):THPDFPage.SetTransparencyGroup 會附加 /Group 字典(/Type /Group /S /Transparency),讓 renderer 能可預期地合成帶 alpha 的內容。可透過 THPDFGroupColorSpace 列舉選擇裝置色彩空間(DeviceGray / DeviceRGB / DeviceCMYK 或省略),或以先前透過 THotPDF.RegisterICCProfile 註冊的 ICC profile 名稱呼叫 THPDFPage.SetTransparencyGroupICC。選用的 /I(Isolated)與 /K(Knockout)旗標可引導 compositor;THPDFPage.ClearTransparencyGroup 會移除先前附加的項目。自 HotPDF v2.32.0 起提供
  • 增量更新(PDF 1.7 ISO 32000-1 7.5.6):THotPDF.BeginIncrementalUpdate(SourceFile) 以 append-only 模式載入既有 PDF;後續的 CreateIndirect* 呼叫會自動把新物件標為 dirty,THotPDF.MarkDirty(Obj) 則把既有的已載入物件標記為需要重新輸出。THotPDF.SaveIncrementalUpdate(TargetFile) 會原樣寫出來源 bytes、只附加 dirty 物件並保留其物件編號、輸出新的 xref 小節,最後以帶 /Prev(指向前一個 xref)的 trailer 收尾。搭配既有的 AddSignedSignatureField + PreparePDFForSigning + InsertSignatureHex 流程,即可對已簽署文件追加後續簽章欄位而不使先前的簽章失效(原始 bytes 未變動,其 /ByteRange 摘要仍有效)。自 HotPDF v2.35.0 起提供
  • 內嵌 TrueType 字型名稱正規化:HotPDF 會讀取內嵌 TrueType name table,並讓 /BaseFont、/FontDescriptor /FontName、/FontFamily 與後代 CID 字型名稱對齊字型程式的 PostScript 名稱。這可避免 PDF 字型字典與內嵌 TTF 內容不一致所造成的 Adobe Acrobat Font Capture 失敗。自 HotPDF v2.35.1 起提供
  • TrueType 字型子集化(PDF 1.7 ISO 32000-1 9.6.4 / 9.8.2):在 BeginDoc 之前把 THotPDF.EnableFontSubsetting 設為 true,HotPDF 會重建嵌入的 TrueType 資料,只保留文件實際用到的字形。典型拉丁文字文件的嵌入字型體積約可減少 90%(一行 "Hello, world." 的 1 MB Arial 縮到約 70 KB)。複合字形的依賴會遞迴追蹤,GID 編號原樣保留(既有的 Type0 / Identity-H 內容串流因此照常運作),新的 /BaseFont 也會自動加上規格要求的六字母 "+" 前綴(例如 /BaseFont /AAAAAA+ArialMT)。預設關閉;需要完整嵌入字型的編輯工作流程可以不開。自 HotPDF v2.36.0 起提供
  • Compact Font Format(CFF)子集化(PDF 1.7 ISO 32000-1 9.7.4 / 9.9):TrueType 子集化的姊妹功能,適用 OpenType-CFF(.otf,sfntVersion OTTO)與 Type 1 / Type 1C 字型。單元匯出的 HPDFSubsetCFF(CFFBytes, KeepGlyph) 函式會重建 CharStrings INDEX,未保留的字形改以最小的 1 位元組 endchar stub 取代,GID 編號逐位元組保留。自 HotPDF v2.37.0 起提供。
  • OpenType-CFF(.otf)嵌入路徑已接入 StoreFont(PDF 1.6+ 9.7.4 Table 117)。當 GDI 載入的字型二進位是 sfnt OTTO 容器時,HotPDF 會透過 HPDFSubsetOTFContainer 子集化內嵌的 'CFF ' 子表,以 /FontFile3 /Subtype /OpenType 輸出字型程式,並以 /Subtype /CIDFontType0 而不是 /CIDFontType2 寫入後代字型字典。TrueType 字型仍走既有的 /FontFile2 + /CIDFontType2 路徑,行為不變。自 HotPDF v2.38.0 起提供。
  • CFF 子常式子集化端到端支援(PDF 1.7 9.7.4 §6 / Adobe Tech Note #5177 §3.1):CFF subsetter 現在會同時移除 Global Subr INDEX(位於 CFF 二進位中 String INDEX 之後)與 Local Subr INDEX(藏於 Private DICT 下,經 Top DICT operator 18 + Private DICT operator 19 抵達)中未使用的項目。單一固定點 closure 會遞移追蹤 callsubr(op 0x0A)與 callgsubr(op 0x1D)鏈,因此 CharString 呼叫 Local Subr、Local Subr 再呼叫 Global Subr、Global Subr 又呼叫另一個 Local Subr 的情況能一次處理完。每個未使用的項目都會換成 1 位元組的 return stub,INDEX 就地改寫並把尾端多餘空間補零。此行為透過公開的 HPDFSubsetCFF 與 HPDFSubsetOTFContainer helper 提供;較低階的 CFF scanner 仍屬內部實作。自 HotPDF v2.39.0 起提供。
  • CID-keyed CFF 子集化(PDF 1.7 ISO 32000-1 9.7.4 / Adobe Tech Note #5176 §18-19):CFF subsetter 現在會辨識標記 CID-keyed OpenType-CFF 字型的 Top DICT ROS operator(12-30),並走訪 Font DICT 的 FDArray(12-36)INDEX,每個 Font DICT 各自帶有 Private DICT 與 Local Subr INDEX。FDSelect(12-37)的 glyph-to-FD 對應會逐位元組保留。subroutine-closure 掃描會追蹤每個保留 CharString 的 FD 脈絡,因此 FD #5 的字形只會標記 FD #5 的 Local Subrs,global subrs 則仍跨 FD 共用。每個 FD 的 Local Subr INDEX 會就地改寫,未使用的項目收斂為 1-byte return stub。CJK / Indic / Arabic OTF 字型(Adobe Fan/Gothic/Heiti/Ming/Myungjo/Song Std、Kozuka Pr6N、Source Han Sans 等)現在會走完整子集化流程,不再原樣嵌入。自 HotPDF v2.40.0 起提供。
  • Object Streams(PDF 1.5 ISO 32000-1 7.5.7):在 UseXRefStream 與 SaveToStream 之外,再把 THotPDF.UseObjectStreams 設為 true,就會把符合條件的間接物件(串流、加密字典,以及 trailer 指向的 Catalog 與 Info 字典以外的全部物件)打包進一個或多個 /Type /ObjStm 容器串流。cross-reference stream 接著以 type-2 項目參照這些打包物件(field-2 = 所屬 ObjStm 物件編號;field-3 = 串流內的項目索引)。對含大量小型字典的 PDF(多頁文件、註解、AcroForm widget、結構樹元素、Optional Content 圖層)可明顯縮小檔案——30 頁純圖形 smoke 從 14502 bytes 縮到 8488 bytes(小 41.5%)。UseXRefStream 關閉(type-2 項目無法以文字型式 xref table 表示)或 Version 低於 PDF 1.5 時,會默默降級為 false。自 HotPDF v2.41.0 起提供。
  • Soft-mask 影像 / SMask(PDF 1.4 ISO 32000-1 8.9.5.4):THotPDF.AddImageWithSMask(Width, Height, RGB, Alpha) 會輸出彩色影像 XObject,外加一個 8-bit DeviceGray soft-mask 影像 XObject,並自動接好 /SMask 交互參照,讓每個像素都能帶完整的逐通道透明度,而不是舊式 /ImageMask 只能二值開關。便利多載 THotPDF.AddImageWithSMask32(Bitmap32) 可從 32-bit BGRA TBitmap 取出 RGB 與 alpha 平面,一次完成含 alpha 的 PNG 嵌入。AddImageWithTransparency 與 AddImageWithTransparency32 以影像為主的命名提供同一流程。兩個呼叫點都經 RequirePDFVersion(pdf14) 把關,strict 模式的 1.3 輸出因此保持合規。自 HotPDF v2.42.0 起提供
  • 影像遮罩輔助方法:AddImageAsMask 輸出二值 /ImageMask,AddImageWithMask 透過 /Mask 把產生的遮罩掛到彩色影像,兩者都回傳一般影像索引供 THPDFPage.ShowImage 使用
  • 逐影像壓縮控制:AddImageWithJpegQuality 一次設定 JPEG 品質且不改動 JpegQuality,AddMonochromeImageAuto 與 icAutoMono 則為 1-bit 點陣輸入選擇 Flate、CCITT Group 4 或 JBIG2
  • 無彩色 Tiling Pattern 繪製(PDF 1.7 ISO 32000-1 8.6.6.1):THotPDF.RegisterTilingPattern 自 v2.19.0 起就會輸出 /PaintType 1(有色)與 /PaintType 2(無色),但頁面端對應的運算子序列此前只對有色變體正確。六個新的 THPDFPage 方法——SetFillPatternRGB / SetStrokePatternRGB / SetFillPatternGray / SetStrokePatternGray / SetFillPatternCMYK / SetStrokePatternCMYK——現在會在頁面 Resources/ColorSpace 字典自動註冊對應的 [/Pattern /BaseCS] 上色色彩空間,並輸出規格要求的 tint_components /Pn scn 序列來驅動無色路徑。色磚自帶顏色的有色變體仍使用原本的 SetFillPattern / SetStrokePattern。自 HotPDF v2.43.0 起提供。
  • 完整的 tiling-pattern 繪製現在會依父內容串流的預設座標系套用 pattern 矩陣,實作三種 /TilingType 放置規則,支援負值的 /XStep 與 /YStep,每個 cell 都以獨立路徑起始,把無色 pattern 的 base tint 同時套用到填色與描邊操作,並保留有界的巢狀 pattern 執行。擴充的 RegisterTilingPattern 多載與 THPDFTilingPatternBuilder.TilingType / Matrix 屬性提供相同的驗證。自 HotPDF v2.542.0 起提供
  • CIELab 色彩空間(PDF 1.3+ ISO 32000-1 8.6.5.3):THotPDF.RegisterLabColorSpace(Xw, Yw, Zw, aMin, aMax, bMin, bMax) 會建立內嵌的 [/Lab << /WhitePoint /BlackPoint /Range >>] 色彩空間陣列,存成自動命名的名稱(Lab1、Lab2、...),並傳回該名稱供一般 THPDFPage.SetFillColorSpace / SetStrokeColorSpace + SetFillColor([L, a, b]) / SetStrokeColor([L, a, b]) 管線使用。ICC 列印工作流程放 D50 光源 [0.9505, 1.0, 1.089],等效 sRGB 的顯示用途放 D65 光源 [0.95047, 1.0, 1.08883],然後以 [0..100] 的 L* 與所選範圍內的 a*、b*(通常 [-128..127])上色。自 HotPDF v2.44.0 起提供
  • 用於 spot colors 的 Separation color space(PDF 1.3+ ISO 32000-1 8.6.6.4):THotPDF.RegisterSeparation(ColorantName, AlternateCS, TintC1) 宣告一個單一 component 的 spot ink,其 [0..1] 內的單一 tint operand 會驅動內部建立的線性 Function Type 2 tint transform。將回傳名稱(Sep1、Sep2、...)搭配一般 SetFillColorSpace / SetStrokeColorSpace + SetFillColor([tint]) / SetStrokeColor([tint]) pipeline 使用。AlternateCS 接受 DeviceGray、DeviceRGB 或 DeviceCMYK;TintC1 提供 tint = 1.0 時的 alt-CS components。Pantone 與其他含空格的 ink names 可直接接受;HotPDF 寫入 color-space name 時會依 PDF 1.7 7.3.5 將空格 escape 為 #20。自 HotPDF v2.45.0 起提供
  • AcroForm multi-line 與 comb text appearance streams(PDF 1.7 ISO 32000-1 12.7.4.3):當 THotPDF.AutoFormAppearances 開啟時,Flags 包含 ffMultiline 的 text fields 會取得 word-wrapped /AP /N Form XObject(Td + T* + /TL leading layout,遵守 CR / LF / CRLF separators 並依可見列數截斷)。Flags 包含 ffComb 且 MaxLen 為正值的欄位,會用每個 glyph 的絕對 Tm matrix 將每個字元繪製到自己的等寬 cell。沒有這些 flags 的欄位會逐位元保留 v2.28.0 的 single-line layout。初始值中的國際字元仍會落到 viewer 的 /NeedAppearances recomputation path;完整 embedded-CID-font appearance generation 仍是未來工作。自 HotPDF v2.46.0 起提供
  • AcroForm /AP Unicode 字型(PDF 1.7 ISO 32000-1 12.7.2 + 12.7.4.3):THotPDF.SetFormUnicodeFontDict(LogicalName, FontDict) 會把呼叫端提供的 Type 0 / CIDFontType2 + Identity-H 複合字型註冊到 AcroForm 的 /DR/Font 預設資源字典。註冊之後,AcroForm 層級的 /DA、每個 Tx widget 的 /DA,以及 AutoFormAppearances 為非 ASCII Tx 初始值產生的 /AP /N 串流都會改用該邏輯名稱;Form XObject 的 /Resources/Font 子字典也會參照同一個間接字型,AP 因而自足,render 時不必依賴 /DR 解析。配套 helper THotPDF.CreateIndirectFontDict 會回傳一個新註冊為間接 PDF 物件的空白 THPDFDictionaryObject,讓呼叫端建構自訂字型字典(或任何需要「N G R」間接序列化的字典)時不必動到內部 helper。傳入空的 LogicalName 與 nil FontDict 可回到 v2.46.0 的純 ASCII /Helv 行為。ASCII Tx 欄位仍使用 /Helv,輸出與 v2.46.0 / v2.55.0 位元組相同。多行 + comb 非 ASCII /AP 與 RTL bidi shaping(UAX #9 + 阿拉伯文 contextual joining)仍屬未來工作。自 HotPDF v2.56.0 起提供;ffMultiline 非 ASCII /AP 支援(逐列 UTF-16BE hex Tj 搭配 Td / T* / /TL leading 與 CJK 感知 word-wrap)自 v2.57.0 起;ffComb 非 ASCII /AP 支援(per-CID 等寬絕對 Tm cell + 每個 code point 的單 cell Tj,並處理 UTF-16 surrogate pair)自 v2.58.0 起;THotPDF.FormUnicodeRTL 屬性提供由右至左方向(在 /AP Tj hex 中反轉 UTF-16 順序,/V 仍保持邏輯順序;呼叫端需先把阿拉伯文預塑形為 Unicode presentation forms U+FB50..U+FDFF + U+FE70..U+FEFF;完整 UAX #9 + 自動 GSUB shaping 尚待實作)自 v2.59.0 起。
  • AcroForm rich-text Tx widget(PDF 1.5+ ISO 32000-1 12.7.4.3 + Annex L):THPDFPage.AddRichTextField(FieldName, InitialValue, RichValue, DefaultStyle, Rectangle, [MaxLen], [Flags]) 會輸出 text widget,包含 /RV(rich-text XHTML body)、/DS(類 CSS default style)、自動 OR 進去的 ffRichText /Ff bit 26 flag,以及不解析 /RV 的 readers 使用的 plain-text /V + /DV fallback。當 RichText bit 開啟時,Acrobat 與 Foxit 會直接從 /RV render,並使用 reader 已安裝 Unicode fonts 的 font fallbacks,因此 multi-byte content(CJK / Cyrillic / Arabic / accented Latin)可正確顯示,不需要 HotPDF 在 /DR Resources 中嵌入 CID font。/V 與 /RV 都會自動偵測 multi-byte input,必要時切換到 UTF-16BE hex-string encoding(FE FF BOM + big-endian code units)。HotPDF 自身 /AP path 的 CID-font appearance-stream generation 仍是未來工作;支援 rich-text 的 viewers 不需要它。自 HotPDF v2.55.0 起提供
  • DeviceN 色彩空間,用於多色版特別色工作流程(PDF 1.3+ ISO 32000-1 8.6.6.5):THotPDF.RegisterDeviceN(ColorantNames, AlternateCS, TintC1Matrix) 把 RegisterSeparation 的單一特別色推廣到 N 色。tint transform 是 PostScript 計算器式的 Function Type 4,對傳入的 N x M 矩陣做線性加權混合(僅 colorant n 為 1.0 時,矩陣第 n 列第 m 欄就是它對 AlternateCS 第 m 個 channel 的貢獻)。傳回色彩空間名稱(DevN1、DevN2、...),搭配一般 SetFillColorSpace + SetFillColor([t0, t1, ..., t_{N-1}]) 管線使用。AlternateCS 接受 DeviceGray、DeviceRGB 或 DeviceCMYK;含空格的油墨名稱依 PDF 1.7 7.3.5 escape 成 #20;特殊名稱 None 代表未使用的色版槽位。自 HotPDF v2.47.0 起提供
  • 自由格式 Gouraud 著色三角網格(PDF 1.3+ ISO 32000-1 8.7.4.5.4):THotPDF.RegisterFreeFormGouraudShading(XMin, YMin, XMax, YMax, NumComponents, Vertices) 宣告帶 /BitsPerCoordinate 16 + /BitsPerComponent 8 + /BitsPerFlag 8 的 /ShadingType 4 串流,包成頁面 Resources/Pattern 字典裡的內嵌 Pattern Type 2 項目,並傳回自動命名的 pattern 名稱(Sh1、Sh2、...)供一般 SetFillPattern / SetStrokePattern 管線使用。每個 vertex 打包成 1 個 flag 位元組(獨立三角形固定為 0)+ 2 個 big-endian X 位元組 + 2 個 big-endian Y 位元組 + NumComponents 個 8 位元顏色 component。NumComponents 接受 1(DeviceGray)、3(DeviceRGB)或 4(DeviceCMYK);每個 vertex 依 (X, Y, c1...cN) 順序對 Vertices 貢獻 2 + NumComponents 個 Extended 值;vertex 數必須是 3 的倍數。/Decode 會把 16 位元座標映射回 [XMin, XMax] x [YMin, YMax],顏色 component 映射到 [0, 1]。Type 5(lattice)、Type 6(Coons patch)與 Type 7(tensor product)網格尚屬未來工作。自 HotPDF v2.48.0 起提供
  • Lattice-form Gouraud-shaded triangle mesh(PDF 1.3+ ISO 32000-1 8.7.4.5.5):THotPDF.RegisterLatticeFormGouraudShading(XMin, YMin, XMax, YMax, NumComponents, VerticesPerRow, Vertices) 宣告 /ShadingType 5 stream,將 vertices 排成 M-row x N-column lattice,並讓 renderer 自動把每對相鄰列三角化為 triangle strip。不同於 RegisterFreeFormGouraudShading(Type 4),它沒有 per-vertex flag byte;shading dictionary 不含 /BitsPerFlag,且每個 vertex 只佔 4 + NumComponents bytes(2 big-endian X + 2 big-endian Y + N color components)。shading dictionary 改為攜帶必要的 /VerticesPerRow N entry。適用於來源資料已位於規則 sample grid(terrain、FEA results、scientific heatmaps)的情境;應用程式以 row-major 提供 vertices,rendering pipeline 會自動組裝 triangle strip topology。VerticesPerRow 至少必須為 2,且 vertex 總數必須是 VerticesPerRow 的倍數並至少有兩列。自 HotPDF v2.49.0 起提供
  • Coons patch mesh shading (PDF 1.3+ ISO 32000-1 8.7.4.5.6): THotPDF.RegisterCoonsPatchMesh(XMin, YMin, XMax, YMax, NumComponents, Patches) declares a /ShadingType 6 stream of Coons patches, each bounded by four cubic Bezier curves and carrying one color per corner. The renderer fits the Coons surface between the four edges, giving an arbitrarily curved color-bearing quad - useful for foil and metallic gradients on bent paths, SVG-derived gradient meshes, and any quad with curved edges that would otherwise need many small triangles to approximate. Each patch contributes 12 control points (24 X+Y Extended values, ordered c1..c12 clockwise around the boundary with c1 / c4 / c7 / c10 at the four corners and the remaining 8 as inner Bezier handles) followed by 4 corner colors (4 * NumComponents Extended values), so the Patches stride is 24 + 4 * NumComponents. The shading dictionary carries the same /BitsPerCoordinate 16 + /BitsPerComponent 8 + /BitsPerFlag 8 as Type 4 (and unlike Type 5, /VerticesPerRow is absent). Every emitted patch carries flag = 0 (independent patch); continuation flags 1 / 2 / 3 (edge sharing) are not exposed in this convenience overload. Available since HotPDF v2.50.0.
  • 含取樣 LUT tint transform 的 Separation 色彩空間(PDF 1.3+ ISO 32000-1 8.6.6.4 + 7.10.2):THotPDF.RegisterSeparationLUT(ColorantName, AlternateCS, Samples) 包裝 RegisterSampledFunction,讓呼叫端把完整的非線性 tint -> alt-CS 曲線表示成 8 位元(M-tuple)取樣組成的平面位元組串流,不必手動建 Function Type 0 字典。色彩轉變非線性時就用 LUT 變體 —— PANTONE Hexachrome 式的 tint ramp、gamma 校正後的濃度曲線、對齊印刷特性曲線的手繪色調曲線、不帶完整 ICC profile 機制的 sRGB 對特別色轉換 ICC LUT;線性單端點情境仍交給 v2.45.0 的 RegisterSeparation。AlternateCS 接受 DeviceGray、DeviceRGB 或 DeviceCMYK;Samples 長度必須是 M 的正倍數且至少 2 * M 位元組,函式才有可內插的範圍;格點數 S 由 Length(Samples) / M 推得。依 PDF 1.7 /Order 1,預設線性內插。傳回註冊後的色彩空間名稱(Sep1、Sep2、...)供一般 SetFillColorSpace + SetFillColor([tint]) 管線使用。自 HotPDF v2.53.0 起提供
  • Function Type 0(取樣)註冊(PDF 1.3+ ISO 32000-1 7.10.2):THotPDF.RegisterSampledFunction(Domain, Range, Size, BitsPerSample, Samples, [Order]) 宣告間接的 /FunctionType 0 串流,把任意的輸入到輸出映射表示成規則的 N 維格點搭配 M 維輸出取樣,並在格點之間內插。適用時機:ICC profile 機制太重、但想要手工調校色彩 LUT 的場合 —— /TransferFunction(ExtGState /TR) 的色調曲線、/Separation / /DeviceN 超出線性 Type 2 / 算術 Type 4 路徑的取樣 tint transform、half-tone 門檻曲線,或任何接受 Function 字典的 PDF 結構。Domain 是 2N 個項目(每個輸入維度一組 [min, max]);Range 是 2M 個項目(每個輸出維度一組);Size 是 N 個格點數;BitsPerSample 依 PDF 1.7 Table 38 接受 1、2、4、8、12、16、24 或 32;Samples 是原始位元打包的取樣串流(每個取樣內 MSB 在前,取樣之間不填充,僅最後位元組補零;依規格的取樣順序規則,輸入 0 變化最快);Order 預設 1(線性),依 PDF 1.7 Table 38 可設 3(三次樣條內插,v2.54.0 起)。HotPDF 會以 ceil(GridPoints * M * BitsPerSample / 8) 驗證取樣位元組數。傳回間接的 THPDFStreamObject,凡需要 Function 字典的地方都能掛上。自 HotPDF v2.52.0 起提供;三次 /Order 3 與端到端多輸入 / 多輸出支援自 v2.54.0 起
  • Tensor product patch mesh shading(PDF 1.3+ ISO 32000-1 8.7.4.5.7):THotPDF.RegisterTensorProductPatchMesh(XMin, YMin, XMax, YMax, NumComponents, Patches) 宣告 tensor-product patches 的 /ShadingType 7 stream,每個 patch 由完整 4 x 4 bicubic Bezier control points p[i][j] 網格加上每個角一個顏色定義。它在 RegisterCoonsPatchMesh(Type 6)的 12 個 boundary points 之外,再加入 4 個明確 interior control points(p[1][1]、p[1][2]、p[2][2]、p[2][1]),因此比 Coons-blended fit 能更細緻控制 patch interior。適合 SVG mesh-gradient round-trips,以及任何需要 tensor-product Bezier surface 的 artwork。每個 patch 提供 16 個 control points(32 個 X+Y Extended values,依規格 Table 88 stream order 排列:p[0][0..3]、p[1][3]、p[2][3]、p[3][3]、p[3][2..0]、p[2][0]、p[1][0],再接 4 個 interior points p[1][1]、p[1][2]、p[2][2]、p[2][1]),後接 4 個 corner colors(位於 p[0][0] / p[0][3] / p[3][3] / p[3][0] 的 4 * NumComponents Extended values),因此 Patches stride 為 32 + 4 * NumComponents。每個輸出的 patch 都帶 flag = 0(independent patch)。至此,完整 ISO 32000-1 8.7.4.5 mesh shading family(Types 4 / 5 / 6 / 7)已全部涵蓋。自 HotPDF v2.51.0 起提供
  • 標註邊框樣式與 Popup 連結(PDF 1.7 12.5.4 / 12.5.6.14):THPDFPage.SetAnnotationBorderStyle(Annot, Width, Style, DashPattern) 會附上帶所選 THPDFAnnotBorderStyle(absSolid / absDashed / absBeveled / absInset / absUnderline)的 /BS 字典。THPDFPage.AddPopupAnnotationFor(ParentAnnot, Rect, Open) 會輸出雙向接線的 /Popup 標註(parent /Popup -> popup、popup /Parent -> parent),檢視器因此畫得出對話氣泡連接線。新的 THPDFPage.LastAnnotation 屬性可餵給上述任一輔助方法,也不改變既有 Add*Annotation 程序的簽名。自 HotPDF v2.34.0 起提供
  • Public-Key Security Handler(PDF 1.7 7.6.5):THotPDF.EnablePubKeyEncryption(seed, KeyType, EncryptMetadata) + THotPDF.AddPubKeyRecipient(envelope) 會輸出 /Filter /Adobe.PubSec encrypt dictionary(/SubFilter /adbe.pkcs7.s4 用於 V=1 RC4-40;/adbe.pkcs7.s5 用於 V=2 RC4-128 / V=4 AESV2)。呼叫端提供 20-byte random seed,以及每位 recipient 一個 PKCS#7 envelopedData binary blob(由 Windows CryptoAPI、OpenSSL 或 pycryptodome 在外部建立)。HotPDF 透過 algorithm 9(seed 與每個 envelope 串接後取 SHA-1)推導 file encryption key,並對 AES-128 / RC4 streams 重用標準 per-object key derivation。自 HotPDF v2.33.0 起提供
  • 已載入頁面的 render 會解碼 Shading Type 4 到 7,涵蓋所有標準的座標、component 與 flag 位元寬度、位元組對齊的記錄、Type 4 三角形與 Type 6 / 7 patch continuation flags、選用的 Function 陣列、宣告的 ColorSpace 轉換、BBox 與 Background 處理、clip culling、批次 Gouraud 填色,以及有界自適應的 Coons 與 tensor-product tessellation。自 HotPDF v2.488.0 起提供

請參閱