Soporte de filtros PDF

Visión general

Los streams PDF y las imágenes incrustadas identifican su codificación mediante nombres de filtro. HotPDF trabaja principalmente con las siguientes familias de filtros al generar documentos o decodificar contenido externo.

Filtros comunes

  • FlateDecode: filtro de compresión principal para los streams generados y la ruta primaria de descompresión basada en zlib
  • LZWDecode: soportado para escenarios legados y de compatibilidad mediante HPDFLZW.pas
  • DCTDecode: usado para datos de imagen JPEG estándar manejados por las rutas de carga de imágenes de HotPDF
  • CCITTFaxDecode: los streams de imágenes monocromas Group 3 y Group 4 cargados soportan filas unidimensionales y bidimensionales, extensiones sin comprimir T.4/T.6, manejo de EOFB, alineación de bytes, polaridad de salida y recuperación acotada de filas dañadas mediante las entradas DecodeParms estándar
  • ASCIIHexDecode / ASCII85Decode / RunLengthDecode: helpers de codificación expuestos en HPDFTypes.pas (_ASCIIHexEncode, _ASCII85Encode, _RunLengthEncode) desde HotPDF v2.4.0. Útiles al envolver contenido binario arbitrario para canales de 7 bits o para soporte explícito de ida y vuelta del PDF 1.7 7.4
  • JBIG2Decode / JPXDecode: nombres de filtro definidos por PDF 1.7 7.4.7 / 7.4.9. HotPDF enruta los streams de imágenes JPXDecode y los archivos JPEG 2000 por el decodificador JPEG2000 respaldado por OpenJPEG, y después incrusta el resultado con la compresión elegida por el llamador. La salida JBIG2 bilevel y las rutas de imágenes JBIG2Decode cargadas usan la tubería nativa de codificación y decodificación JBIG2, incluidos los controles de diccionario de símbolos, segmentos globales, nivel con pérdida y filtrado de puntos negros

Notas prácticas

  • No todos los filtros se exponen a través de una única API genérica; algunos se alcanzan mediante unidades helper dedicadas de imagen o de streams
  • Para el contenido PDF generado, THotPDF.Compression sigue siendo el ajuste central de cara al usuario
  • Al cargar datos externos, el filtro aplicable depende del formato del archivo de origen y de la clase helper utilizada
  • 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
  • Las políticas de crypt filter reservadas pueden seleccionarse de forma independiente para cadenas, streams normales y streams de archivos incrustados mediante ConfigureCryptFilterDefaults. La seguridad por contraseña acepta StdCF o Identity, mientras que la de clave pública acepta DefaultCryptFilter o Identity. SetStreamCryptFilter añade o limpia un filtro Crypt inicial explícito sin alterar una canalización de decodificación existente. Las anulaciones por stream exigen un diccionario de cifrado /V 4 o posterior
  • Los wrappers de payload cifrado mantienen visibles los streams de página ordinarios mientras protegen los metadatos y bytes de archivos incrustados mediante un crypt filter EFOpen, con APIs explícitas de inspección y desbloqueo de documentos cargados disponibles desde HotPDF v2.715.0
  • Los streams de adjuntos protegidos por contraseña usan /EFF y reciben un filtro Crypt explícito siempre que /EFF difiera de /StmF. Los filtros de stream explícitos cifrados con clave pública fallan de forma cerrada porque requieren un sobre de destinatarios específico del stream
  • Los documentos cargados exponen la política original /CF, /StrF, /StmF y /EFF, incluidos filtros con nombre externos sensibles a mayúsculas, /CFM /None explícito u omitido, eventos de autenticación y longitud de clave efectiva a través de THPDFCryptFilterInfo. Las longitudes de filtro del manejador estándar V2 se leen en bytes, las de filtro de clave pública V2 en bits, y solo se aceptan claves V2 de 40 y 128 bits. Los contenedores de object streams en texto plano todavía descifran las cadenas de miembros empaquetados a través de /StrF, mientras que los contenedores cifrados evitan un segundo descifrado de miembros. Las actualizaciones incrementales conservan la política cargada. Disponible desde HotPDF v2.675.0
  • Los campos de formulario interactivos se emiten como anotaciones Widget que el lector pinta; consulte Soporte AcroForm
  • Las anotaciones de marcado de texto (Highlight, Underline, Squiggly, StrikeOut) y los enlaces de salto dentro del documento (GoTo, GoToR, Launch) se exponen como nuevos métodos THPDFPage.Add*Annotation / AddGoToLink / AddGoToRLink / AddLaunchLink desde HotPDF v2.6.0
  • La salida DeviceCMYK está disponible mediante THPDFPage.SetCMYKColor / SetCMYKFillColor / SetCMYKStrokeColor; los espacios de color gestionados por ICC se registran con THotPDF.RegisterICCProfile y se aplican vía SetFillColorSpace / SetStrokeColorSpace + SetFillColor / SetStrokeColor desde HotPDF v2.7.0
  • Set THotPDF.UseXRefStream to true before saving to emit 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); auto-built from the Info dict fields, or supply a hand-authored packet via CustomXMP. Available since HotPDF v2.9.0
  • Per-method PDF version gating (since HotPDF v2.24.0). Every feature method introduced in v2.4.0+ consults RequirePDFVersion before emitting; with StrictVersionLock=false (the default) the document Version is silently auto-bumped to the minimum the feature requires, and with StrictVersionLock=true the call is refused so the saved file strictly conforms to the chosen 1.3 / 1.4 / 1.5 / 1.6 / 1.7 reference spec.
  • Codificadores con predictor PNG y TIFF para datos de imagen comprimidos con FlateDecode (PDF 1.7 7.4.4.4): _PNGPredictorEncode aplica la heurística de filtro de diferencia absoluta mínima de libpng (Predictor=15) y _TIFFPredictor2Encode aplica diferenciación horizontal (Predictor=2). Disponible desde 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 color selects DeviceGray (1) / DeviceRGB (3) / DeviceCMYK (4). Available since HotPDF v2.13.0; Function Type 3 multi-stop gradients are exposed through RegisterMultiStopAxialGradient since v2.18.0 and RegisterMultiStopRadialGradient since v2.686.0
  • Inline images (PDF 1.7 8.9.7) via THPDFPage.DrawInlineImage; raw bytes are auto-wrapped with ASCIIHex when no Filter is supplied so the content stream stays 7-bit-clean. Available since HotPDF v2.18.0
  • OutputIntents (PDF 1.7 14.11) via THotPDF.AddOutputIntent; each call appends a /Type /OutputIntent dict to the Catalog with optional /DestOutputProfile referencing 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 form fields and HotPDF will pre-build a /Subtype /Form Form XObject for each widget's /AP /N entry (Yes / Off sub-dicts for buttons), populate the AcroForm /DR default resources with Helvetica / ZapfDingbats indirect font dicts, and switch /NeedAppearances to false so renderers honor the embedded streams. Available since HotPDF v2.28.0
  • ViewerPreferences /ViewArea and /ViewClip (PDF 1.4 12.2 Table 152) are now exposed through THotPDF.ViewArea / THotPDF.ViewClip properties (with the matching vpViewArea / vpViewClip set members). Both accept the THPDFPageBoundary values (MediaBox / CropBox / BleedBox / TrimBox / ArtBox) and complete 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 on 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 the THPDFTransitionStyle enumeration; companion /Dm, /M and /Di sub-options are also exposed. THPDFPage.SetPageDuration writes the /Dur auto-advance delay in seconds. Available since HotPDF v2.30.0
  • Page-level transparency group (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 color space through the THPDFGroupColorSpace enumeration (DeviceGray / DeviceRGB / DeviceCMYK or omit), or call THPDFPage.SetTransparencyGroupICC with the name of an ICC profile previously 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; subsequent CreateIndirect* calls auto-mark new objects dirty, and THotPDF.MarkDirty(Obj) tags pre-existing loaded objects for re-emission. THotPDF.SaveIncrementalUpdate(TargetFile) writes the original source bytes verbatim, appends only dirty objects with their object numbers preserved, emits a new xref subsection, and finishes with a trailer carrying /Prev pointing at the previous xref. Combine with the existing AddSignedSignatureField + PreparePDFForSigning + InsertSignatureHex pipeline to add subsequent signature fields to an already-signed document without invalidating earlier signatures (their /ByteRange digests remain valid because none of the original bytes mutate). Available since HotPDF v2.35.0
  • Normalización de nombres de fuentes TrueType incrustadas: HotPDF lee la tabla de nombres TrueType incrustada y alinea /BaseFont, /FontDescriptor /FontName, /FontFamily y los nombres de fuentes CID descendientes con el nombre PostScript del programa de fuente. Esto evita fallos de Adobe Acrobat Font Capture causados por un desajuste entre el diccionario de fuente PDF y el payload TTF incrustado. Disponible desde 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
  • Subsetter de Compact Font Format (CFF) (PDF 1.7 ISO 32000-1 9.7.4 / 9.9): compañero del subsetter TrueType para fuentes OpenType-CFF (.otf, sfntVersion OTTO) y Type 1 / Type 1C. La función exportada por la unidad HPDFSubsetCFF(CFFBytes, KeepGlyph) reconstruye el INDEX de CharStrings con los glifos no conservados reemplazados por el stub endchar mínimo de 1 byte, preservando la numeración de GIDs byte a byte. Disponible desde HotPDF v2.37.0.
  • Ruta de incrustación OpenType-CFF (.otf) cableada en StoreFont (PDF 1.6+ 9.7.4 Tabla 117). Cuando el binario de fuente cargado por GDI es un contenedor sfnt OTTO, HotPDF aplica subsetting a la subtabla 'CFF ' incrustada mediante HPDFSubsetOTFContainer, emite el programa de fuente vía /FontFile3 /Subtype /OpenType y escribe el diccionario de fuente descendiente con /Subtype /CIDFontType0 en lugar de /CIDFontType2. Las fuentes TrueType siguen por la ruta existente /FontFile2 + /CIDFontType2 sin cambio de comportamiento. Disponible desde HotPDF v2.38.0.
  • CFF subroutine subsetting end-to-end (PDF 1.7 9.7.4 §6 / Adobe Tech Note #5177 §3.1): the CFF subsetter now strips unused entries from BOTH the Global Subr INDEX (located immediately after String INDEX in the CFF binary) and the Local Subr INDEX (nested under Private DICT, reached via Top DICT operator 18 + Private DICT operator 19). A single fixed-point closure follows callsubr (op 0x0A) AND callgsubr (op 0x1D) chains transitively, so a CharString that calls a Local Subr that calls a Global Subr that calls another Local Subr is picked up in one iteration. Each unused entry is replaced by a 1-byte return stub and the INDEX is rewritten in place with the trailing slack zero-filled. This behavior is exposed through the public HPDFSubsetCFF and HPDFSubsetOTFContainer helpers; lower-level CFF scanners remain internal. Available since HotPDF v2.39.0.
  • Subsetting CFF con claves CID (PDF 1.7 ISO 32000-1 9.7.4 / Adobe Tech Note #5176 §18-19): el subsetter CFF reconoce ahora el operador Top DICT ROS (12-30) que marca una fuente OpenType-CFF con claves CID y recorre el INDEX FDArray (12-36) de Font DICTs, cada uno con su propio Private DICT + Local Subr INDEX. El mapa glifo-a-FD FDSelect (12-37) se preserva byte a byte. El escaneo de cierre de subrutinas rastrea el contexto FD de cada CharString conservada, de modo que un glifo en FD #5 marca las Local Subrs solo del FD #5; las subrs globales siguen compartidas entre FDs. El INDEX de Local Subrs de cada FD se reescribe in situ con las entradas no usadas colapsadas a stubs return de 1 byte. Las fuentes OTF CJK / índicas / árabes (Adobe Fan/Gothic/Heiti/Ming/Myungjo/Song Std, Kozuka Pr6N, Source Han Sans, etc.) pasan ahora por el pipeline completo de subsetting en lugar de incrustarse tal cual. Disponible desde HotPDF v2.40.0.
  • Object Streams (PDF 1.5 ISO 32000-1 7.5.7): set THotPDF.UseObjectStreams to true in addition to 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 inside the stream). Cuts file size substantially on PDFs with many small dictionaries (multi-page documents, annotations, AcroForm widgets, structure-tree elements, Optional Content layers) - a 30-page graphics-only smoke shrinks from 14502 to 8488 bytes (41.5% smaller). Silently downgrades to false when UseXRefStream is off (type-2 entries are not representable in the textual xref table per spec) or when Version is below PDF 1.5. Available since HotPDF v2.41.0.
  • Imagen de soft-mask / SMask (PDF 1.4 ISO 32000-1 8.9.5.4): THotPDF.AddImageWithSMask(Width, Height, RGB, Alpha) emite un image XObject en color más un image XObject de soft-mask DeviceGray de 8 bits y conecta automáticamente la referencia cruzada /SMask, de modo que cada píxel puede llevar transparencia completa por canal en lugar del límite binario de encendido/apagado de la ruta legada /ImageMask. La sobrecarga de conveniencia THotPDF.AddImageWithSMask32(Bitmap32) extrae los planos RGB y alfa de un TBitmap BGRA de 32 bits para incrustar PNG con alfa en una sola llamada. AddImageWithTransparency y AddImageWithTransparency32 exponen el mismo flujo con nombres centrados en la imagen. Ambos puntos de llamada pasan por RequirePDFVersion(pdf14) para que la salida en modo estricto 1.3 siga siendo conforme. Disponible desde HotPDF v2.42.0
  • Helpers de conveniencia para máscaras de imagen: AddImageAsMask emite una /ImageMask binaria, AddImageWithMask adjunta la máscara resultante a una imagen en color mediante /Mask, y ambos devuelven índices de imagen normales para THPDFPage.ShowImage
  • Controles de compresión por imagen: AddImageWithJpegQuality aplica calidad JPEG de una llamada sin cambiar JpegQuality, mientras AddMonochromeImageAuto e icAutoMono eligen Flate, CCITT Group 4 o JBIG2 para bitmaps de 1 bit
  • Pintado de Tiling Patterns sin color (PDF 1.7 ISO 32000-1 8.6.6.1): THotPDF.RegisterTilingPattern emite tanto /PaintType 1 (con color) como /PaintType 2 (sin color) desde v2.19.0, pero la secuencia de operadores de página correspondiente solo era correcta para la variante con color. Seis métodos nuevos de THPDFPage (SetFillPatternRGB / SetStrokePatternRGB / SetFillPatternGray / SetStrokePatternGray / SetFillPatternCMYK / SetStrokePatternCMYK) manejan ahora la ruta sin color registrando automáticamente el espacio de color de tintado [/Pattern /BaseCS] correspondiente en el diccionario Resources/ColorSpace de la página y emitiendo la secuencia tint_components /Pn scn que manda la especificación. Use el SetFillPattern / SetStrokePattern original para la variante con color, donde el tile lleva su propio color. Disponible desde HotPDF v2.43.0.
  • El renderizado completo de tiling patterns aplica ahora la matriz del patrón respecto al sistema de coordenadas por defecto del content stream padre, implementa las tres reglas de colocación de /TilingType, soporta /XStep y /YStep negativos, empieza cada celda con un path aislado, aplica el tinte base de un patrón sin color tanto a relleno como a trazo, y retiene la ejecución acotada de patrones anidados. La sobrecarga extendida de RegisterTilingPattern y las propiedades THPDFTilingPatternBuilder.TilingType / Matrix exponen los mismos controles validados para PDFs generados. Disponible desde HotPDF v2.542.0
  • CIELab color 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 >>] color 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 color space for spot colors (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 a linear Function Type 2 tint transform built internally. Use the returned name (Sep1, Sep2, ...) with the regular SetFillColorSpace / SetStrokeColorSpace + SetFillColor([tint]) / SetStrokeColor([tint]) pipeline. AlternateCS accepts DeviceGray, DeviceRGB or DeviceCMYK; TintC1 supplies the alt-CS components at tint = 1.0. Pantone and other ink names with spaces are accepted directly - HotPDF escapes them to #20 per PDF 1.7 7.3.5 when writing the color-space name. Available since HotPDF v2.45.0.
  • Streams de apariencia de texto multi-línea y comb de AcroForm (PDF 1.7 ISO 32000-1 12.7.4.3): cuando THotPDF.AutoFormAppearances está activo, los campos de texto cuyos Flags incluyen ffMultiline obtienen un Form XObject /AP /N con ajuste de palabra (layout Td + T* + interlineado /TL, respetando separadores CR / LF / CRLF y truncando en el recuento de filas visibles). Los campos cuyos Flags incluyen ffComb junto con un MaxLen positivo renderizan cada carácter en su propia celda de ancho igual usando una matriz Tm absoluta por glifo. El layout de una línea de v2.28.0 se preserva byte a byte en campos sin esos flags. Los caracteres internacionales en el valor inicial siguen cayendo a la ruta de recálculo /NeedAppearances del visor; la generación completa de apariencias con fuentes CID incrustadas sigue siendo trabajo futuro. Disponible desde 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 serialization) without touching internal helpers. Pass empty LogicalName and nil FontDict to revert to the v2.46.0 ASCII-only /Helv behavior. 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, plus the plain-text /V + /DV fallback used by readers that do not parse /RV. Acrobat and Foxit render directly from /RV when the RichText bit is on, picking up font fallbacks from the reader's installed Unicode fonts - so multi-byte content (CJK / Cyrillic / Arabic / accented Latin) displays correctly without HotPDF embedding a CID font in /DR Resources. Both /V and /RV auto-detect multi-byte input and switch to UTF-16BE hex-string encoding (FE FF BOM + big-endian code units) when needed. CID-font appearance-stream generation for HotPDF's own /AP path remains future work; rich-text-aware viewers do not need it. Available since HotPDF v2.55.0.
  • DeviceN color 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 color-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 color 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 color 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 x N-column lattice and lets the renderer auto-triangulate each pair of adjacent rows into a triangle strip. Unlike RegisterFreeFormGouraudShading (Type 4), there is no per-vertex flag byte; /BitsPerFlag is absent from the shading dictionary and each vertex occupies only 4 + NumComponents bytes (2 big-endian X + 2 big-endian Y + N color components). The shading dictionary instead carries the required /VerticesPerRow N entry. Use it for source data that is already on a regular sample grid (terrain, FEA results, scientific heatmaps) - the application supplies vertices row-major and the rendering pipeline assembles the triangle strip topology automatically. VerticesPerRow must be at least 2 and 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 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.
  • Separation color 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 color 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 color-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 color 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.
  • Shading de malla de patches de tensor producto (PDF 1.3+ ISO 32000-1 8.7.4.5.7): THotPDF.RegisterTensorProductPatchMesh(XMin, YMin, XMax, YMax, NumComponents, Patches) declara un stream /ShadingType 7 de patches de tensor producto, cada uno definido por una rejilla completa 4 x 4 de puntos de control Bézier bicúbicos p[i][j] más un color por esquina. Extiende RegisterCoonsPatchMesh (Type 6) añadiendo 4 puntos de control interiores explícitos (p[1][1], p[1][2], p[2][2], p[2][1]) sobre los 12 puntos de frontera, lo que da un control más fino del interior del patch del que puede expresar el ajuste mezclado de Coons. Útil para viajes de ida y vuelta de mesh-gradients SVG y cualquier obra que necesite una superficie Bézier de tensor producto. Cada patch aporta 16 puntos de control (32 valores Extended X+Y, ordenados según el orden de stream de la Tabla 88 de la especificación: p[0][0..3], p[1][3], p[2][3], p[3][3], p[3][2..0], p[2][0], p[1][0], y después los 4 puntos interiores p[1][1], p[1][2], p[2][2], p[2][1]) seguidos de 4 colores de esquina (4 * NumComponents valores Extended en p[0][0] / p[0][3] / p[3][3] / p[3][0]), así que el stride de Patches es 32 + 4 * NumComponents. Cada patch emitido lleva flag = 0 (patch independiente). Con esta versión, toda la familia de mesh shadings ISO 32000-1 8.7.4.5 (Types 4 / 5 / 6 / 7) queda cubierta. Disponible desde 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
  • Manejador de seguridad de clave pública (ISO 32000-1 7.6.4, ISO 32000-2 7.6.5): THotPDF.EnablePubKeyEncryption(seed, KeyType, EncryptMetadata) + THotPDF.AddPubKeyRecipient(envelope) emiten un diccionario de cifrado /Filter /Adobe.PubSec (/SubFilter /adbe.pkcs7.s4 para V=1 RC4-40 / /adbe.pkcs7.s5 para V=2 RC4-128 / V=4 AESV2). El llamador suministra la semilla aleatoria de 20 bytes y un blob binario PKCS#7 envelopedData por destinatario (construido externamente con Windows CryptoAPI, OpenSSL o pycryptodome). HotPDF deriva la clave de cifrado del archivo como describe ISO 32000-1 7.6.4.3 (SHA-1 de la semilla concatenada con cada envelope) y reutiliza la derivación de clave por objeto estándar para streams AES-128 / RC4. Disponible desde HotPDF v2.33.0
  • El renderizado de páginas cargadas decodifica los Shading Types 4 a 7 con todos los anchos estándar de coordenadas, componentes y bits de flags, registros alineados a byte, flags de continuación de triángulos Type 4 y patches Type 6 / 7, arrays de Function opcionales, conversión declarada de ColorSpace, manejo de BBox y Background, descarte por recorte, rellenos Gouraud por lotes y teselación adaptativa acotada de Coons y tensor-product. Disponible desde HotPDF v2.488.0

Véase también