Native Linux HTML, Editing, OCR and Archival Workflows
Enterprise edition: The JSON/C ABI entry point and HPDFHeadlessArchival belong to HotPDF Enterprise (Lib/Enterprise); underlying core Pascal units listed below retain Single edition availability.
Missing-appearance text-field recovery honors single-line fixed-size clipping and zero-size fitting, draws stored FileSelect paths and DoNotScroll values, and retains generated text as vector resources through opt-in page import
The native Linux callback ABI accepts html.import, text.draw, ocr, and pdfa.convert with schemaVersion 1 and the existing output, result, working-byte and pixel budgets
Edition requirements
The JSON workflows on this page use the Enterprise native Linux callback ABI; its entry project, public headers, symbol map and Lib/Enterprise sources are omitted from STD and SME installations
The native archival facade HPDFHeadlessArchival is also in Lib/Enterprise. Core Pascal interfaces such as AppendPageText, HPDFRecognizeHeadlessPage and the shared native HTML canvas retain their own unit availability; an operation exposed by the Enterprise ABI does not make all of its underlying core units Enterprise-only
Use the supplied Linux build paths for all three source layers and keep the Linux entry headless; the Windows/VCL HPDFEnterprise registration unit is not part of this build
HTML import
{"schemaVersion":1,"type":"html.import","html":"<h1>Invoice</h1><p>Searchable Unicode</p>","createAcroForms":true}
HTML import works on an empty handle and uses the shared HTML5/CSS layout engine with a native drawing canvas, Fontconfig matching, embedded Unicode TrueType fonts, HarfBuzz/FriBidi shaping, PNG/JPEG/BMP/GIF resources, alpha masks, hyperlinks, pagination and AcroForm controls
The ABI accepts inline data resources and an optional operation-owned resources array for caller-supplied stylesheets, images and fonts through the existing importer callback
Each resource requires the string members uri, kind, contentType and dataBase64; kind is exactly stylesheet, image or font, and nonempty payloads use canonical padded Base64
URI and content type must not be empty; lookup uses the exact decoded Unicode URI together with its kind, duplicate pairs are parameter errors, and data: keys are reserved for existing inline resource decoding
Stylesheet links, image sources and @font-face URLs consume matching entries; contentType is advisory, an empty dataBase64 string permits an empty stylesheet, and missing entries retain the importer's existing skip or fallback behavior
The registry decodes supplied bytes once and retains them through importer and canvas cleanup for the current operation; entries are not carried to later operations, while saved PDFs retain their rendered resources
Existing JSON admission, working-byte, request-count, resource-delivery, decoded-image, output and cancellation limits remain in force, including repeated resource request accounting and the fixed 1024-entry registry limit
The registry resolver performs no implicit file or network lookup; existing native Fontconfig fallback still uses host font files, so this feature does not make the entire renderer filesystem-independent
{"schemaVersion":1,"type":"html.import","html":"<link rel=\"stylesheet\" href=\"memory:theme.css\"><p>Hello</p>","resources":[{"uri":"memory:theme.css","kind":"stylesheet","contentType":"text/css","dataBase64":"cHtjb2xvcjpyZWR9"}]}
Optional pageWidth and pageHeight use points; maxPages and maxLayoutOperations must be positive, and DOM, CSS, resource and image allocations also follow the operation budget
Missing image resources with a nonempty alt use literal styled alternative text with one entity-decoding pass, normal wrapping and measured height in bounded Flex/Grid children; available images suppress their alternatives, ASCII-whitespace-only alternatives add no text, and existing inline-image limitations remain unchanged
Page text editing
{"schemaVersion":1,"type":"text.draw","page":0,"text":"Searchable Unicode","left":36,"bottom":36,"right":559,"top":108,"fontFamily":"DejaVu Sans","fontSize":12,"textColor":[0,0,1],"alignment":"center","rotation":90,"fitToRectangle":false,"invisible":true}
Insertion preserves original page streams, including indirectly referenced content arrays, and appends an embedded Unicode form appearance with a private resource name; invisible text uses rendering mode 3 and remains searchable
Coordinates are unrotated PDF user-space points; characterSpacing and wordSpacing use points, and authenticated AES-256 replacements retain encryption, passwords and permissions
textColor is an RGB array of exactly three finite numbers from 0 to 1 and defaults to black; alignment is left, center or right and defaults to left
rotation is a signed Int32 multiple of 90, defaults to 0 and is normalized to a counterclockwise quarter turn; 90 and 270 swap the appearance logical width and height inside the physical rectangle
fitToRectangle defaults to false; when true, the existing native fitting path forces left alignment and zero padding, derives the font size from the selected font's vertical metrics and uses horizontal text scaling to fill the logical width
These JSON options use the existing AppendPageText behavior; unknown alignment values, malformed colors, non-quarter-turn rotation and incorrect option types are parameter errors
Actual OCR
{"schemaVersion":1,"type":"ocr","pages":[0],"language":"eng","dpi":216,"searchLayer":true,"maxMilliseconds":120000}
OCR renders actual page pixels and invokes the installed Tesseract executable directly with an argument vector, reads bounded TSV words, validates UTF-8, confidences and page coordinates, and maps rotated/cropped page geometry back to PDF coordinates. OCR uses inherited page boxes and rotation when local entries are missing or null, normalizes either ordering of rectangle corners, and uses a unit scale of 1 when the page's /UserUnit is missing or null
On Linux ARM64, the Cairo render pass preserves the calling thread's hardware floating-point control register. A native deployment check (Tests/Linux/LinuxDeployment.en-us.md) verified an invisible searchable text layer from Tesseract and unchanged rendered pixels
Omit pages to process every page in document order. An explicit list uses zero-based indexes and preserves their order. Invalid or repeated indexes are rejected before recognition
The result includes per-page words with text, confidence, left, bottom, right and top; searchLayer: false reads the loaded PDF directly and returns recognition data. searchLayer: true stages edits in a working copy and emits a PDF with fitted invisible embedded-font text. OCR resolves fontFamily for the search layer when it first writes a recognized word. Recognition-only requests and search-layer requests with no recognized words skip that lookup. A search-layer request that finds no words returns the input PDF byte for byte, including when the selected page list is empty. The normal output byte limit applies
Optional tesseractPath selects an explicit executable; maxWords caps the total recognized words across all selected pages, including when searchLayer is false. A request over the limit publishes no PDF. Pages with no recognized words can follow a page that reaches the word limit. limits.resultBytes bounds the serialized JSON response, including pages with no recognized words. OCR checks this budget as pages and words are added and publishes no PDF if the response exceeds it. The confidence and time limits also bound recognition, and cancellation or timeout terminates and reaps the running process
Native PDF/A-4 raster output
{"schemaVersion":1,"type":"pdfa.convert","profile":"PDF/A-4","dpi":144}
Native raster conversion authors fresh unencrypted PDF 2.0 pages with baked page rotation, PDF/A-4 XMP, document identifiers and a generated embedded sRGB output intent; current acceptance includes independent veraPDF validation with zero failed rules and checks
The output rasterizes original text and vectors, flattens visible appearances, replaces source metadata and drops interactive fields, actions, attachments and signatures; the result reports rasterized, removedFormFields and removedSignatures
Signed inputs require explicit allowSignatureInvalidation true; raster conversion flattens visible annotations through their normal appearances or the renderer's supported missing-appearance fallback, with explicit errors for unsupported or malformed cases
Native text/vector preservation provides a searchable conversion mode with genuine validation; its page-import flattening path requires a usable normal appearance except for explicitly enabled missing-FreeText synthesis, and wider widget or geometric synthesis remains separate work
Explicit archival font repair embeds available substitutes through bounded Ghostscript normalization, retains searchable text and vectors, and validates PDF/A-4 before publication
Publication and runtimes
All binary output is prepared before callbacks; a generated or edited document replaces the handle only after output and JSON callbacks succeed, and failures preserve the previous context
Native HTML requires FCL image readers, Fontconfig, installed Unicode TrueType fonts, HarfBuzz and FriBidi; OCR additionally requires Tesseract and trained language data, and archival profile generation requires Little CMS 2
Fontconfig and FriBidi are loaded dynamically and shared by native canvas, annotation, HTML bidirectional and shaping operations; set HOTPDF_FONTCONFIG_LIBRARY and HOTPDF_FRIBIDI_LIBRARY to explicit matching-architecture paths before the first font lookup or shaping call, otherwise Linux uses libfontconfig.so.1 and libfribidi.so.0; the bindings are cached behind a critical section by HPDFGetPlatformFontConfigAPI in HPDFPlatform and HPDFGetHeadlessBidiAPI in HPDFHeadlessShaping, each raising on a missing library or symbol, and the FriBidi loader returns the THPDFHeadlessBidiAPI record with the module handle and the cdecl binding pointers
Callback ABI · Native drawing canvas · Pascal OCR API · Pascal archival API
Append selected pages and validate text/vector-preserving PDF/A-4 output
Opt-in missing-appearance import also synthesizes multiline, password and rich-text fields through the native font and text layout; plain and authenticated AES-256 source imports retain searchable nonpassword text and identical generated-appearance pixels after source release and save/reload
Default-style comb appearances also participate in opt-in vector import; logical text extraction uses marked-content ActualText for shaped output, while positioned glyph extraction retains its physical records