THPDFRenderDocAccess Record
把轉譯器繫結到文件服務,用於解析參照、讀取串流、解碼影像、定位字型與評估圖層可見性
宣告
THPDFRenderDocAccess= record
Context: Pointer;
SharedCache: THPDFRendererSharedCache;
ShareRenderCaches: boolean;
// v2.375.0 generic indirect-ref resolver (any object type). The typed
// Resolve* fields below predate it and return nil for non-matching
// types, which silently dropped indirect refs to arrays (e.g. a
// /ColorSpace entry pointing at a [/Separation ...] array object)
ResolveObject: function(Context: Pointer; Obj: THPDFObject): THPDFObject;
ResolveDictionary: function(Context: Pointer; Obj: THPDFObject): THPDFDictionaryObject;
ResolveStream: function(Context: Pointer; Obj: THPDFObject): THPDFStreamObject;
ReadDecodedStreamBytes: function(Context: Pointer; Stream: THPDFStreamObject; out Bytes: TBytes): boolean;
AcquireDecodedImageStream: function(Context: Pointer;
Stream: THPDFStreamObject): IHPDFDecodedBitmapHandle;
DecodeImageStream: function(Context: Pointer; Stream: THPDFStreamObject): TBitmap;
BeginProgressiveImageDecode: function(Context: Pointer;
Stream: THPDFStreamObject;
CancellationToken: THPDFCancellationToken): IHPDFProgressiveImageDecoder;
DecodeImageRegion: function(Context: Pointer; Stream: THPDFStreamObject;
RegionLeft, RegionTop, RegionRight, RegionBottom,
DesiredWidth, DesiredHeight: Integer): TBitmap;
AcquireDecodedImageRegion: function(Context: Pointer;
Stream: THPDFStreamObject; RegionLeft, RegionTop, RegionRight,
RegionBottom, DesiredWidth,
DesiredHeight: Integer): IHPDFDecodedBitmapHandle;
// v2.425.0 inline-image decoder: builds a throwaway stream from the raw
// ID..EI bytes and the normalised BI key set, then decodes it without the
// ObjectNumber-keyed cache (inline images have no object number). Returns
// a TBitmap the caller owns, or nil on failure. Nil hook = inline images
// are not rendered (legacy behaviour)
DecodeInlineImage: function(Context: Pointer; const Bytes: TBytes;
const Keys: THPDFInlineImgKeys): TBitmap;
// Colour-key /Mask array of an image XObject as a soft mask, white where
// the image shows and black where it is masked out. Returns a TBitmap the
// caller owns, or nil when the image has no usable colour-key mask; a nil
// hook draws such images unmasked
DecodeColorKeyMask: function(Context: Pointer;
Stream: THPDFStreamObject): TBitmap;
// Look up a font dictionary by resource key in a Resources dict, following
// indirect refs at both /Resources and /Font levels. Returns nil if absent
ResolveFontDict: function(Context: Pointer; PageObj: THPDFDictionaryObject;
const FontKey: AnsiString): THPDFDictionaryObject;
// v2.377.0 optional-content visibility oracle: evaluates an /OC property
// object (OCG or OCMD) against the document's layer states. Nil hook or
// a True result means the content is drawn
EvalOCVisibility: function(Context: Pointer; PropObj: THPDFObject): boolean;
CancellationToken: THPDFCancellationToken;
ColourIntent: Integer;
FallbackPolicy: THPDFRenderFallbackPolicy;
FallbackDiagnosticLimit: Integer;
OverprintPreview: boolean;
ProofICCProfile: TBytes;
OutputICCProfile: TBytes;
BlackPointCompensation: boolean;
SeparationPlate: AnsiString;
end;
單元
HPDFPageRenderer
欄位
| 欄位 | 用途 |
|---|---|
Context | 呼叫端提供的內容指標,作為每個回呼的第一個參數;文件會把自己繫結在這裡 |
SharedCache | 啟用 ShareRenderCaches 時,可由多個頁面共用的轉譯器快取 |
ShareRenderCaches | 文件允許並行轉譯器共用解碼快取時為 True |
ResolveObject | 適用於任何物件型別的通用間接參照解析器;因為各型別專用解析器對不符合的型別會傳回 nil 而新增 |
ResolveDictionary | 把間接參照解析為字典物件,其他型別傳回 nil |
ResolveStream | 把間接參照解析為串流物件 |
ReadDecodedStreamBytes | 把串流完整解碼讀入位元組陣列 |
AcquireDecodedImageStream | 把影像 XObject 解碼成共用的參照計數點陣圖控制代碼 |
DecodeImageStream | 把影像 XObject 解碼成呼叫端自有的點陣圖 |
BeginProgressiveImageDecode | 為大型影像串流啟動可取消的漸進式解碼器 |
DecodeImageRegion | 以要求的像素大小解碼影像的子區域 |
AcquireDecodedImageRegion | 區域版本,傳回共用的參照計數點陣圖控制代碼 |
DecodeInlineImage | 從原始 ID..EI 位元組與正規化的 BI 金鑰集解碼內嵌影像,不經過物件編號快取;hook 為 nil 表示不轉譯內嵌影像 |
DecodeColorKeyMask | 把影像 XObject 的 color-key /Mask 陣列變成與影像同尺寸的白黑柔光遮罩;影像沒有可用的 color-key mask 時為 nil,hook 為 nil 時這類影像不加遮罩直接繪製 |
ResolveFontDict | 依資源鍵查找字型字典,會跟隨 /Resources 與 /Font 層級的間接參照;不存在時為 nil |
EvalOCVisibility | 依文件圖層狀態評估 /OC 屬性物件;hook 為 nil 或結果為 True 表示內容會被繪出 |
CancellationToken | 長時間解碼操作期間檢查的取消 token |
ColourIntent | 套用到轉譯後圖形狀態的色彩處理意圖 |
FallbackPolicy | 選擇不支援功能要忽略、回報,還是視為嚴格失敗 |
FallbackDiagnosticLimit | 限制退回期間收集的診斷訊息數量上限 |
OverprintPreview | 啟用疊印預覽模擬 |
ProofICCProfile | 色彩管線打樣端使用的 ICC profile 位元組 |
OutputICCProfile | 描述輸出裝置的 ICC profile 位元組 |
BlackPointCompensation | 在 ICC 轉換中啟用黑點補償 |
SeparationPlate | 要隔離輸出的特別色版名稱;留空則正常轉譯 |
使用說明
- THotPDF 透過內部
MakeRenderDocAccess輔助方法繫結每個 hook,應用程式拿到的是現成記錄,不必自己填 - 自訂轉譯後端從
THPDFPageRenderBackendRequest讀取這些 hook,而不是直接深入文件 - 把
DecodeInlineImage或EvalOCVisibility留成 nil,即可還原跳過內嵌影像、繪出所有選擇性內容的舊行為