Rendering Diagnostics and Operation Telemetry
HotPDF distinguishes rendered-page cache entries by every caller-visible state that can change page pixels and exposes bounded diagnostics when page content cannot be rendered completely
State-aware cache variants
THotPDF.RenderLoadedPageToBitmapCached keys memory entries by page, DPI, effective optional-content visibility, THotPDF.RenderColourIntent, and THotPDF.RenderFallbackPolicy
The persistent cache uses the same state digest, whilst diagnostic-producing fallback modes remain memory-only so a disk hit cannot lose skipped-object reports
Changing an optional-content group selects another variant instead of deleting the previous bitmap, so switching a layer or colour intent back can reuse earlier work
Colour intent
PDF.RenderColourIntent := rciRelativeColorimetric;
Bitmap := PDF.RenderLoadedPageToBitmapCached(0, 144);
rciDocument honours each content-stream ri operator and remains the default
The four explicit values override content-stream intent selection and are applied to subsequent ICCBased fill and stroke conversions
Fallback policy
PDF.RenderFallbackPolicy := rfpReport;
PDF.RenderFallbackDiagnosticLimit := 256;
Bitmap := PDF.RenderLoadedPageToBitmap(0, 144);
Diagnostics := PDF.GetLastRenderFallbackDiagnostics;
rfpIgnorepreserves the legacy permissive rendering, and still counts each event it withholdsrfpReportrecords unsupported operators, missing resources, invalid objects, decode failures, recursion limits, and unsupported object typesrfpStrictraises at the first fallback outside aBXandEXcompatibility sectionTHotPDF.RenderFallbackDiagnosticLimitbounds retained diagnosticsTHotPDF.LastRenderFallbackDroppedCountreports the events a render withheld, whether the policy suppressed them or the retained array had already reached its bound
THotPDF.GetLastRenderFallbackDiagnostics returns the retained set, whilst THotPDF.ClearLastRenderFallbackDiagnostics clears it; cached report-mode entries retain their diagnostic set, so a memory cache hit returns the same rendering completeness information as the original render
A caller who never touches the policy therefore still learns that content fell back: the count is nonzero whilst the retained set stays empty, which is the signal to switch to rfpReport and name the events. The disk tier cannot retain either, so a page served from it replays with an empty set and a zero count
Each retained entry is a THPDFRenderFallbackDiagnostic carrying a Kind, the OperatorName and ObjectName involved and a diagnostic Reason
The Kind values are THPDFRenderFallbackKind: rfkUnsupportedOperator, rfkMissingResource, rfkInvalidObject, rfkDecodeFailure, rfkRecursionLimit and rfkUnsupportedObject
Unified operation telemetry
if PDF.GetLastOperationTelemetry(Info) then
begin
WriteLn(Info.OperationName);
WriteLn(Info.ElapsedMilliseconds);
WriteLn(Info.CPUTimeMicroseconds);
WriteLn(Info.PeakProcessMemoryBytes);
WriteLn(Info.MemorySchedulerWaitMilliseconds);
WriteLn(Info.DecodeExpansionPermille);
end;
THotPDF.GetLastOperationTelemetry returns a THPDFOperationTelemetry record containing wall time, current-thread CPU time, memory, allocation, process I/O, filter decode, cache, object-count, success, and cancellation metrics
Document loading, synchronous and cached page rendering, progressive render slices, selective stream optimisation, and parallel image optimisation publish the same record shape
PeakMemoryBytes is a portable document-operation estimate rather than the operating-system process working set, so it remains stable across hosts and includes loaded source bytes, rendered bitmap entries, decoded-image cache weight, and peak filter-chain storage
PeakProcessMemoryBytes is the largest sampled process working set, whilst AllocationCount is the largest sampled increase in concurrently live Delphi memory-manager blocks relative to operation start rather than a lifetime allocation total
CPUTimeMicroseconds measures the calling thread, whilst ReadIOBytes, WriteIOBytes, and OtherIOBytes are process-wide counter deltas and can therefore include concurrent work in the same process
DecodeInputBytes is compressed input, DecodeOutputBytes is final filter-chain output, and DecodedBytes is aggregate work across every filter stage; DecodeExpansionPermille divides final output by input, with 1000 representing 1x
ScheduledMemoryBytes is the operation admission estimate, MemorySchedulerWaitMilliseconds records queue time, and MemorySchedulerDelayed distinguishes queued admission from the allocation-free fast path
Memory and allocation peaks are sampled at operation boundaries, filter-chain completion, progressive slices, and cancellation checkpoints, so they are low-overhead operational signals rather than instruction-level profiler traces