PDF Filter Support

Overview

PDF streams and embedded images declare their encoding with filter names. When HotPDF creates documents or decodes imported content it chiefly deals with the filter families below

Common Filters

  • FlateDecode: the principal compression filter for generated streams and the main zlib-based decompression route
  • LZWDecode: available for older files and compatibility cases through HPDFLZW.pas
  • DCTDecode: Used for standard JPEG image data handled by HotPDF image loading paths
  • CCITTFaxDecode: Common in monochrome TIFF and fax-style image data
  • ASCIIHexDecode / ASCII85Decode / RunLengthDecode: encoder helpers exposed in HPDFTypes.pas (_ASCIIHexEncode, _ASCII85Encode, _RunLengthEncode) since HotPDF v2.4.0. They are useful for wrapping arbitrary binary content for 7-bit channels and for explicit PDF 1.7 7.4 round-trip coverage
  • JBIG2Decode / JPXDecode: Filter names defined by PDF 1.7 7.4.7 / 7.4.9. HotPDF's bundled JBIG2 and JPEG 2000 helpers are stubs that report unsupported (return False) until a real OpenJPEG / JBIG2 backend is linked. Earlier builds returned a fake 100×100 success which produced unreadable images; this is now corrected

Practical Notes

  • Not every filter is exposed through a single generic API; some are reached through dedicated image or stream helper units
  • For generated PDF content, THotPDF.Compression remains the central user-facing setting
  • For externally loaded data, the filter in use depends on the source format and on the helper class selected by the caller
  • Encrypted PDFs combine these filters with the security handler; see CryptKeyLength for the supported AES‑128 (V=4 R=4 / CFM=AESV2) and RC4 (V=1/V=2) options
  • Interactive form fields are emitted as Widget annotations that the viewer paints; see AcroForm Support
  • Text-markup annotations (Highlight, Underline, Squiggly, StrikeOut) and intra-document jump links (GoTo, GoToR, Launch) are exposed as new THPDFPage.Add*Annotation / AddGoToLink / AddGoToRLink / AddLaunchLink methods since HotPDF v2.6.0
  • DeviceCMYK output is exposed through THPDFPage.SetCMYKColor, SetCMYKFillColor, and SetCMYKStrokeColor; ICC-managed colour spaces are registered with THotPDF.RegisterICCProfile and applied through SetFillColorSpace / SetStrokeColorSpace plus SetFillColor / SetStrokeColor since HotPDF v2.7.0
  • Set THotPDF.UseXRefStream to true before saving to write a single /Type /XRef FlateDecode-compressed cross-reference stream instead of the textual xref / trailer / startxref sequence (PDF 1.7 7.5.8). Available since HotPDF v2.8.0
  • Set THotPDF.EnableXMPMetadata to true to attach an XMP /Type /Metadata /Subtype /XML stream to the Catalog (PDF 1.7 14.3.2). HotPDF can build it from Info dictionary fields automatically, or the caller may provide a hand-authored packet through CustomXMP. Available since HotPDF v2.9.0
  • Per-method PDF version gating has been in place since HotPDF v2.24.0. Every feature method introduced in v2.4.0 and later calls RequirePDFVersion before emitting output; with StrictVersionLock=false (the default), Version is quietly raised to the minimum required version, while StrictVersionLock=true refuses the call so the saved file remains within the chosen 1.3 / 1.4 / 1.5 / 1.6 / 1.7 reference specification
  • PNG and TIFF predictor encoders for FlateDecode-compressed image data (PDF 1.7 7.4.4.4): _PNGPredictorEncode applies the libpng minimum-absolute-difference filter heuristic (Predictor=15), and _TIFFPredictor2Encode applies horizontal differencing (Predictor=2). Available since HotPDF v2.10.0
  • Tagged PDF entry points (PDF 1.7 14.7-14.8): THotPDF.Lang populates /Lang in the Catalog, EnableTaggedPDF emits /MarkInfo <</Marked true>> and a stub /StructTreeRoot, and the new THPDFPage.BeginMarkedContent / BeginMarkedContentMCID / EndMarkedContent methods write the BMC / BDC / EMC content-stream operators. Available since HotPDF v2.11.0
  • Axial and radial gradients (PDF 1.7 7.10 / 8.7): THotPDF.RegisterAxialGradient / RegisterRadialGradient build the full Function Type 2 / Shading Type 2-3 / Pattern Type 2 stack and return a stable pattern name; THPDFPage.SetFillPattern / SetStrokePattern install it onto the page. Component count of the start / end colour selects DeviceGray (1) / DeviceRGB (3) / DeviceCMYK (4). Available since HotPDF v2.13.0; multi-stop axial gradients via Function Type 3 are exposed through RegisterMultiStopAxialGradient since v2.18.0
  • Inline images (PDF 1.7 8.9.7) are written through THPDFPage.DrawInlineImage; when no Filter is supplied, raw bytes are wrapped automatically with ASCIIHex so the content stream remains 7-bit clean. Available since HotPDF v2.18.0
  • OutputIntents (PDF 1.7 14.11) are added with THotPDF.AddOutputIntent; each call appends a /Type /OutputIntent dictionary to the Catalog, with an optional /DestOutputProfile reference to a registered ICC profile. Available since HotPDF v2.18.0
  • AcroForm appearance-stream auto-generation (PDF 1.7 12.5.5 / 12.7.3.3 / 8.10): set THotPDF.AutoFormAppearances to true before adding interactive fields and HotPDF pre-builds a /Subtype /Form Form XObject for each widget's /AP /N entry (including Yes / Off sub-dictionaries for buttons), fills the AcroForm /DR default resources with Helvetica / ZapfDingbats indirect font dictionaries, and sets /NeedAppearances to false so renderers honour the embedded streams. Available since HotPDF v2.28.0
  • ViewerPreferences /ViewArea and /ViewClip (PDF 1.4 12.2 Table 152) are exposed through the THotPDF.ViewArea and THotPDF.ViewClip properties, together with the matching vpViewArea and vpViewClip set members. Both accept THPDFPageBoundary values (MediaBox / CropBox / BleedBox / TrimBox / ArtBox), completing HotPDF's coverage of the four PDF 1.4 page-boundary ViewerPreferences. Available since HotPDF v2.29.0
  • Page transitions (PDF 1.1 / 1.5 12.4.4): THPDFPage.SetPageTransition writes a /Trans dictionary to the page so PDF readers in /PageMode /FullScreen animate navigation. PDF 1.1 styles (Split, Blinds, Box, Wipe, Dissolve, Glitter, R) and PDF 1.5 styles (Fly, Push, Cover, Uncover, Fade) are exposed through THPDFTransitionStyle; companion /Dm, /M, and /Di sub-options are also available. THPDFPage.SetPageDuration writes the /Dur automatic advance delay in seconds. Available since HotPDF v2.30.0
  • Page-level transparency groups (PDF 1.4 11.6.6 / 7.5.5): THPDFPage.SetTransparencyGroup attaches a /Group dictionary (/Type /Group /S /Transparency) so renderers composite alpha-bearing content predictably. Choose a device colour space through THPDFGroupColorSpace (DeviceGray / DeviceRGB / DeviceCMYK or omitted), or call THPDFPage.SetTransparencyGroupICC with the name of an ICC profile registered through THotPDF.RegisterICCProfile. Optional /I (Isolated) and /K (Knockout) flags steer the compositor; THPDFPage.ClearTransparencyGroup removes a previously attached entry. Available since HotPDF v2.32.0
  • Incremental update (PDF 1.7 ISO 32000-1 7.5.6): THotPDF.BeginIncrementalUpdate(SourceFile) loads an existing PDF in append-only mode; later CreateIndirect* calls mark new objects dirty automatically, and THotPDF.MarkDirty(Obj) marks pre-existing loaded objects for re-emission. THotPDF.SaveIncrementalUpdate(TargetFile) writes the original bytes unchanged, appends only dirty objects with their object numbers preserved, emits a new xref subsection, and ends with a trailer whose /Prev points to the previous xref. Combine it with the existing AddSignedSignatureField + PreparePDFForSigning + InsertSignatureHex pipeline to add later signature fields to an already signed document without invalidating earlier signatures, because their /ByteRange digests still cover unchanged original bytes. Available since HotPDF v2.35.0
  • Embedded TrueType font-name normalisation: HotPDF reads the embedded TrueType name table and aligns /BaseFont, /FontDescriptor /FontName, /FontFamily, and descendant CID font names with the font programme's PostScript name. This prevents Adobe Acrobat Font Capture failures caused by a mismatch between the PDF font dictionary and the embedded TTF payload. Available since HotPDF v2.35.1
  • TrueType font subsetting (PDF 1.7 ISO 32000-1 9.6.4 / 9.8.2): set THotPDF.EnableFontSubsetting to true before BeginDoc and HotPDF rebuilds the embedded TrueType payload to contain only the glyphs actually used by the document. Typical Latin documents see ~90% reduction in embedded font weight (1 MB Arial -> ~70 KB on a one-line "Hello, world."). Composite-glyph dependencies are tracked recursively, GID numbering is preserved (so existing Type0 / Identity-H content streams keep working), and the new /BaseFont automatically gains the spec-mandated six-letter "+"-suffixed prefix (e.g. /BaseFont /AAAAAA+ArialMT). Off by default; enable opt-in to keep full-font embedding for editing workflows. Available since HotPDF v2.36.0
  • Compact Font Format (CFF) subsetter (PDF 1.7 ISO 32000-1 9.7.4 / 9.9): companion to the TrueType subsetter for OpenType-CFF (.otf, sfntVersion OTTO) and Type 1 / Type 1C fonts. The unit-exported HPDFSubsetCFF(CFFBytes, KeepGlyph) function rebuilds the CharStrings INDEX with un-kept glyphs replaced by the minimal 1-byte endchar stub, preserving GID numbering byte-for-byte. Available since HotPDF v2.37.0.
  • The OpenType-CFF (.otf) embed path is wired into StoreFont (PDF 1.6+ 9.7.4 Table 117). When the GDI-loaded font binary is an sfnt OTTO container, HotPDF subsets the embedded CFF sub-table through HPDFSubsetOTFContainer, emits the font programme through /FontFile3 /Subtype /OpenType, and writes the descendant font dictionary with /Subtype /CIDFontType0 rather than /CIDFontType2. TrueType fonts continue to use the existing /FontFile2 + /CIDFontType2 path with no behaviour change. Available since HotPDF v2.38.0
  • CFF subroutine subsetting is end-to-end (PDF 1.7 9.7.4 §6 / Adobe Tech Note #5177 §3.1): the subsetter strips unused entries from both the Global Subr INDEX (after String INDEX in the CFF binary) and the Local Subr INDEX (under Private DICT, reached through Top DICT operator 18 and Private DICT operator 19). A fixed-point closure follows callsubr (op 0x0A) and callgsubr (op 0x1D) chains transitively, so nested Local / Global Subr dependencies are kept in one iteration. Each unused entry is replaced by a 1-byte return stub and the INDEX is rewritten in place with trailing slack zero-filled. The behaviour is exposed through HPDFSubsetCFF and HPDFSubsetOTFContainer; lower-level CFF scanners remain internal. Available since HotPDF v2.39.0
  • CID-keyed CFF subsetting (PDF 1.7 ISO 32000-1 9.7.4 / Adobe Tech Note #5176 §18-19): the CFF subsetter recognises the Top DICT ROS operator (12-30) that marks a CID-keyed OpenType-CFF font and walks the FDArray (12-36) INDEX of Font DICTs, each with its own Private DICT and Local Subr INDEX. The FDSelect (12-37) glyph-to-FD map is preserved byte-for-byte. The subroutine-closure scan tracks each kept CharString's FD context, so a glyph in FD #5 marks Local Subrs in FD #5 only while global subrs remain shared. Each FD's Local Subr INDEX is rewritten in place with unused entries collapsed to 1-byte return stubs. CJK / Indic / Arabic OTF fonts such as Adobe Fan/Gothic/Heiti/Ming/Myungjo/Song Std, Kozuka Pr6N, and Source Han Sans now use full subsetting rather than being embedded as-is. Available since HotPDF v2.40.0
  • Object Streams (PDF 1.5 ISO 32000-1 7.5.7): set THotPDF.UseObjectStreams to true alongside UseXRefStream, and SaveToStream packs eligible indirect objects (everything except streams, the encryption dictionary, and the trailer-pointed Catalog and Info dictionaries) into one or more /Type /ObjStm container streams. The cross-reference stream then references the packed objects through type-2 entries (field-2 = host ObjStm object number; field-3 = entry index). This can substantially reduce files with many small dictionaries; a 30-page graphics-only smoke file shrank from 14502 to 8488 bytes (41.5% smaller). The setting quietly falls back to false when UseXRefStream is off or when Version is below PDF 1.5. Available since HotPDF v2.41.0
  • Soft-mask image / SMask (PDF 1.4 ISO 32000-1 8.9.5.4): THotPDF.AddImageWithSMask(Width, Height, RGB, Alpha) emits a colour image XObject plus an 8-bit DeviceGray soft-mask image XObject and wires the /SMask reference automatically, so every pixel can carry per-channel transparency rather than the binary on/off limit of the older /ImageMask path. The convenience overload THotPDF.AddImageWithSMask32(Bitmap32) extracts RGB and alpha planes from a 32-bit BGRA TBitmap for one-call PNG-with-alpha embedding. Both paths gate through RequirePDFVersion(pdf14) so strict-mode 1.3 output remains compliant. Available since HotPDF v2.42.0
  • Uncoloured Tiling Pattern painting (PDF 1.7 ISO 32000-1 8.6.6.1): THotPDF.RegisterTilingPattern has emitted both /PaintType 1 (coloured) and /PaintType 2 (uncoloured) since v2.19.0, but the page-side operator sequence used to be correct only for the coloured variant. Six THPDFPage methods, SetFillPatternRGB, SetStrokePatternRGB, SetFillPatternGray, SetStrokePatternGray, SetFillPatternCMYK, and SetStrokePatternCMYK, now drive the uncoloured path by auto-registering the matching [/Pattern /BaseCS] tinting colour space on the page Resources/ColorSpace dictionary and emitting the required tint_components /Pn scn sequence. Use the original SetFillPattern / SetStrokePattern for coloured tiles. Available since HotPDF v2.43.0
  • CIELab colour space (PDF 1.3+ ISO 32000-1 8.6.5.3): THotPDF.RegisterLabColorSpace(Xw, Yw, Zw, aMin, aMax, bMin, bMax) builds an inline [/Lab << /WhitePoint /BlackPoint /Range >>] colour space array, stores it under an auto-generated name (Lab1, Lab2, ...) and returns that name for use with the regular THPDFPage.SetFillColorSpace / SetStrokeColorSpace + SetFillColor([L, a, b]) / SetStrokeColor([L, a, b]) pipeline. Drop in a D50 illuminant [0.9505, 1.0, 1.089] for ICC print workflows or a D65 illuminant [0.95047, 1.0, 1.08883] for sRGB-equivalent display, then paint with L* in [0..100] and a*, b* in the chosen range (typically [-128..127]). Available since HotPDF v2.44.0.
  • Separation colour space for spot colours (PDF 1.3+ ISO 32000-1 8.6.6.4): THotPDF.RegisterSeparation(ColorantName, AlternateCS, TintC1) declares a one-component spot ink whose single tint operand in [0..1] drives an internally built linear Function Type 2 tint transform. Use the returned name (Sep1, Sep2, ...) with the regular SetFillColorSpace / SetStrokeColorSpace plus SetFillColor([tint]) / SetStrokeColor([tint]) pipeline. AlternateCS accepts DeviceGray, DeviceRGB, or DeviceCMYK; TintC1 supplies the alternate colour-space components at tint = 1.0. Pantone and other ink names with spaces are accepted directly, and HotPDF escapes them to #20 per PDF 1.7 7.3.5 when writing the colour-space name. Available since HotPDF v2.45.0
  • AcroForm multi-line and comb text appearance streams (PDF 1.7 ISO 32000-1 12.7.4.3): when THotPDF.AutoFormAppearances is enabled, text fields whose Flags include ffMultiline receive a word-wrapped /AP /N Form XObject (Td + T* + /TL leading layout), honouring CR / LF / CRLF separators and truncating at the visible row count. Fields with ffComb and a positive MaxLen render each character into an equal-width cell using an absolute Tm matrix per glyph. The single-line layout from v2.28.0 is unchanged for fields without these flags. International initial values still rely on the viewer's /NeedAppearances recomputation path; full embedded-CID-font appearance generation remains future work. Available since HotPDF v2.46.0
  • AcroForm /AP Unicode font (PDF 1.7 ISO 32000-1 12.7.2 + 12.7.4.3): THotPDF.SetFormUnicodeFontDict(LogicalName, FontDict) registers a caller-supplied Type 0 / CIDFontType2 + Identity-H composite font in the AcroForm /DR/Font default-resources dict. Once registered, the AcroForm-level /DA, every Tx widget's /DA, and the /AP /N stream produced by AutoFormAppearances for non-ASCII Tx initial values all switch to the logical name; the Form XObject's /Resources/Font sub-dict also references the same indirect font so the AP is self-contained without depending on /DR resolution at render time. The companion helper THotPDF.CreateIndirectFontDict returns a fresh empty THPDFDictionaryObject registered as an indirect PDF object so callers can build custom font dicts (or any other dict requiring "N G R" indirect serialisation) without touching internal helpers. Pass empty LogicalName and nil FontDict to revert to the v2.46.0 ASCII-only /Helv behaviour. ASCII Tx fields continue to use /Helv with byte-identical output to v2.46.0 / v2.55.0. Multi-line + comb non-ASCII /AP and RTL bidi shaping (UAX #9 + Arabic contextual joining) remain future work. Available since HotPDF v2.56.0; ffMultiline non-ASCII /AP support (per-line UTF-16BE hex Tj with Td / T* / /TL leading and CJK-aware word-wrap) since v2.57.0; ffComb non-ASCII /AP support (per-CID equal-width absolute Tm cells + single-cell Tj per code point with UTF-16 surrogate-pair handling) since v2.58.0; THotPDF.FormUnicodeRTL property for right-to-left direction (reverses UTF-16 order in /AP Tj hex while keeping /V in logical order; caller pre-shapes Arabic to Unicode presentation forms U+FB50..U+FDFF + U+FE70..U+FEFF; full UAX #9 + automatic GSUB shaping pending) since 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]) emits a text widget with /RV (rich-text XHTML body), /DS (CSS-like default style), the ffRichText /Ff bit 26 flag automatically OR'd in, and the plain-text /V + /DV fallback for readers that do not parse /RV. Acrobat and Foxit render from /RV when the RichText bit is set, using installed Unicode font fallbacks, so CJK / Cyrillic / Arabic / accented Latin content displays without HotPDF embedding a CID font in /DR Resources. Both /V and /RV switch automatically to UTF-16BE hex-string encoding (FE FF BOM + big-endian code units) when multi-byte input is detected. CID-font appearance-stream generation for HotPDF's own /AP path remains future work. Available since HotPDF v2.55.0
  • DeviceN colour space for multi-colorant spot-ink workflows (PDF 1.3+ ISO 32000-1 8.6.6.5): THotPDF.RegisterDeviceN(ColorantNames, AlternateCS, TintC1Matrix) generalises RegisterSeparation from a single spot ink to N. The tint transform is a PostScript-calculator Function Type 4 emitting a linear weighted-blend over the supplied N x M matrix (row n column m is colorant n's contribution to AlternateCS channel m when colorant n is 1.0 alone). Returns a colour-space name (DevN1, DevN2, ...) that drives the regular SetFillColorSpace + SetFillColor([t0, t1, ..., t_{N-1}]) pipeline. AlternateCS accepts DeviceGray, DeviceRGB or DeviceCMYK; ink names with spaces are escaped to #20 per PDF 1.7 7.3.5; the special name None marks an unused colorant slot. Available since HotPDF v2.47.0.
  • Free-form Gouraud-shaded triangle mesh (PDF 1.3+ ISO 32000-1 8.7.4.5.4): THotPDF.RegisterFreeFormGouraudShading(XMin, YMin, XMax, YMax, NumComponents, Vertices) declares a /ShadingType 4 stream with /BitsPerCoordinate 16 + /BitsPerComponent 8 + /BitsPerFlag 8, wraps it in an inline Pattern Type 2 entry on the page Resources/Pattern dict, and returns the auto-generated pattern name (Sh1, Sh2, ...) for the regular SetFillPattern / SetStrokePattern pipeline. Each vertex is packed as 1 flag byte (always 0 for independent triangles) + 2 big-endian X bytes + 2 big-endian Y bytes + NumComponents 8-bit colour components. The NumComponents argument accepts 1 (DeviceGray), 3 (DeviceRGB) or 4 (DeviceCMYK); each vertex contributes 2 + NumComponents Extended values to Vertices in (X, Y, c1...cN) order; vertex count must be a multiple of 3. /Decode maps the 16-bit coordinates back to [XMin, XMax] x [YMin, YMax] and the colour components to [0, 1]. Type 5 (lattice), Type 6 (Coons patch) and Type 7 (tensor product) mesh shadings remain future work. Available since 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) declares a /ShadingType 5 stream that arranges vertices in an M-row by N-column lattice and lets the renderer triangulate each adjacent row pair into a strip. Unlike RegisterFreeFormGouraudShading (Type 4), there is no per-vertex flag byte; /BitsPerFlag is absent and each vertex occupies only 4 + NumComponents bytes (2 big-endian X + 2 big-endian Y + N colour components). The dictionary instead carries the required /VerticesPerRow N entry. Use it when source data is already on a regular sample grid, such as terrain, FEA output, or scientific heatmaps. VerticesPerRow must be at least 2, and the total vertex count must be a multiple of VerticesPerRow with at least two rows. Available since 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 colour per corner. The renderer fits the Coons surface between the four edges, which is useful for foil and metallic gradients on curved paths, SVG-derived gradient meshes, and curved-edge quads that would otherwise require many triangles. Each patch contributes 12 control points (24 X+Y Extended values, ordered c1..c12 clockwise with c1 / c4 / c7 / c10 at the corners and the remaining 8 as inner Bezier handles) followed by 4 corner colours, so the Patches stride is 24 + 4 * NumComponents. The dictionary uses /BitsPerCoordinate 16, /BitsPerComponent 8, and /BitsPerFlag 8; /VerticesPerRow is absent. Each emitted patch uses flag = 0; continuation flags 1 / 2 / 3 are not exposed by this convenience overload. Available since HotPDF v2.50.0
  • Separation colour space with sampled LUT tint transform (PDF 1.3+ ISO 32000-1 8.6.6.4 + 7.10.2): THotPDF.RegisterSeparationLUT(ColorantName, AlternateCS, Samples) wraps RegisterSampledFunction so callers can express a full non-linear tint -> alt-CS curve as a flat byte stream of 8-bit (M-tuple) samples without manually constructing a Function Type 0 dictionary. Use the LUT variant when the colour transition is non-linear - PANTONE Hexachrome-style tint ramps, gamma-corrected density curves, hand-drawn tone curves matching a press characterisation, sRGB-to-spot conversion ICC LUTs without the full ICC profile machinery; the v2.45.0 RegisterSeparation entry point still covers the linear single-endpoint case. AlternateCS accepts DeviceGray, DeviceRGB or DeviceCMYK; Samples length must be a positive multiple of M with at least 2 * M bytes so the function has interpolable range, and the grid-point count S is inferred from Length(Samples) / M. Linear interpolation is the default per PDF 1.7 /Order 1. Returns the registered colour-space name (Sep1, Sep2, ...) for use with the regular SetFillColorSpace + SetFillColor([tint]) pipeline. Available since HotPDF v2.53.0.
  • Function Type 0 (Sampled) registration (PDF 1.3+ ISO 32000-1 7.10.2): THotPDF.RegisterSampledFunction(Domain, Range, Size, BitsPerSample, Samples, [Order]) declares an indirect /FunctionType 0 stream that expresses an arbitrary input-to-output mapping as a regular N-dimensional grid of M-dimensional output samples, interpolated between grid points. Use it where ICC profile machinery is overkill but a hand-tuned colour LUT is desired - tone curves for /TransferFunction (ExtGState /TR), sampled tint transforms for /Separation / /DeviceN beyond the linear Type 2 / arithmetic Type 4 paths, halftone threshold curves, or any other PDF construct that takes a Function dictionary. Domain is 2N entries (one [min, max] pair per input dimension); Range is 2M entries (one pair per output dimension); Size is N grid-point counts; BitsPerSample accepts 1, 2, 4, 8, 12, 16, 24, or 32 per PDF 1.7 Table 38; Samples is the raw bit-packed sample stream (MSB-first within each sample, no padding between samples beyond the final-byte zero-fill, with input 0 varying fastest per spec sample-order rules); Order defaults to 1 (linear) and accepts 3 (cubic-spline interpolation, since v2.54.0) per PDF 1.7 Table 38. HotPDF validates the sample-byte count against ceil(GridPoints * M * BitsPerSample / 8). Returns the indirect THPDFStreamObject so callers can attach it wherever a Function dictionary is expected. Available since HotPDF v2.52.0; cubic /Order 3 + end-to-end multi-input / multi-output coverage since 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) declares a /ShadingType 7 stream of tensor-product patches, each defined by a full 4 x 4 grid of bicubic Bezier control points p[i][j] and one colour per corner. It extends RegisterCoonsPatchMesh (Type 6) with four explicit interior control points, allowing finer interior control than the Coons-blended fit. It suits SVG mesh-gradient round-trips and artwork requiring a tensor-product Bezier surface. Each patch contributes 16 control points (32 X+Y Extended values in Table 88 stream order) plus 4 corner colours at p[0][0] / p[0][3] / p[3][3] / p[3][0], so the Patches stride is 32 + 4 * NumComponents. Every emitted patch uses flag = 0. With this release, the ISO 32000-1 8.7.4.5 mesh shading family (Types 4 / 5 / 6 / 7) is covered. Available since HotPDF v2.51.0
  • Annotation border style and Popup linkage (PDF 1.7 12.5.4 / 12.5.6.14): THPDFPage.SetAnnotationBorderStyle(Annot, Width, Style, DashPattern) attaches a /BS dictionary with the chosen THPDFAnnotBorderStyle (absSolid / absDashed / absBeveled / absInset / absUnderline). THPDFPage.AddPopupAnnotationFor(ParentAnnot, Rect, Open) emits a /Popup annotation that is wired in both directions (parent /Popup -> popup, popup /Parent -> parent) so the viewer can render the speech-balloon connector. The new THPDFPage.LastAnnotation property feeds either helper without changing the signature of the existing Add*Annotation procedures. Available since HotPDF v2.34.0
  • Public-Key Security Handler (PDF 1.7 7.6.5): THotPDF.EnablePubKeyEncryption(seed, KeyType, EncryptMetadata) plus THotPDF.AddPubKeyRecipient(envelope) emit a /Filter /Adobe.PubSec encryption dictionary (/SubFilter /adbe.pkcs7.s4 for V=1 RC4-40, /adbe.pkcs7.s5 for V=2 RC4-128 / V=4 AESV2). The caller supplies the 20-byte random seed and one PKCS#7 envelopedData binary blob per recipient, built externally with Windows CryptoAPI, OpenSSL, or pycryptodome. HotPDF derives the file encryption key through algorithm 9 (SHA-1 of seed concatenated with each envelope) and reuses the standard per-object key derivation for AES-128 / RC4 streams. Available since HotPDF v2.33.0

See Also