Native Linux C ABI

Enterprise edition: This API belongs to HotPDF Enterprise (HotPDFEnt / Lib\Enterprise); lower editions omit it or raise EHPDFEnterpriseRequired.

HotPDFLinuxABI.lpr builds a native Linux ELF shared library for x86_64 or ARM64 (aarch64), with SONAME libhotpdf.so.1 and public symbols assigned to HOTPDF_1.0

The library uses THPDFHeadlessDocument and CPU rendering without a Windows component, an active desktop, a PDF viewer, or a Python process at runtime; Python is used by the build and acceptance scripts

The text.extract operation preserves Unicode in both its UTF-8 JSON result and optional UTF-8 binary text output without an implicit system ANSI conversion; C and C.UTF-8 process locales use the same text encoding contract, while acceptance records identify the exact locale, source and compiler used rather than implying that every installed locale has been tested

Edition and source layout

The native Linux callback ABI is distributed with HotPDF Enterprise; the STD and SME installers omit HotPDFLinuxABI.lpr, the public ABI headers and symbol map, and Lib/Enterprise, so those installations cannot build this entry point

Build from an Enterprise source installation with Lib, Lib/SmallBusiness and Lib/Enterprise present; the supplied Linux build script already searches all three directories for the relocated native ABI, archival and comparison units

Copy the installation tree to Linux with its relative paths and filename case intact. The Enterprise installer supplies the build helpers, PIC guide and focused deployment kit under Tests/Linux and the CMap notice under Licenses, including installations that select another help language

This Linux entry uses headless Pascal units directly; do not add the Windows/VCL HPDFEnterprise registration unit to it. The core headless document API remains a separate Pascal interface, and this ABI distribution boundary does not move every native editing, rendering, OCR, shaping or signing primitive into Enterprise

Build and acceptance

Building the library requires native Linux FPC 3.3.1 or later with matching FCL and paszlib units, GNU binutils, Python 3, file and ldd. Use a compiler that targets the build host's architecture. Prepare a fresh isolated PIC unit tree (Tests/Linux/LinuxPICUnits.en-us.md) for a build that must load without text relocations, then select the product compiler generated by that procedure

FPC_EXE=/absolute/path/to/pic/PICProductCompiler.py \
HPDF_LINUX_OUTPUT=/absolute/path/to/fresh-abi \
HPDF_REQUIRE_NO_TEXTREL=1 sh Tests/Linux/Build-LinuxABI.sh

Stage the Enterprise Linux package

From the root of the Enterprise source installation, stage the build output and both public headers. The build copies the CMap redistribution notice from Licenses when the English help directory is absent

abi_output=/absolute/path/to/fresh-abi
package=/absolute/path/package
mkdir -p "$package/include"
cp "$abi_output/libhotpdf.so.1" "$abi_output/NativeCMapDataLicense.html" "$package/"
cp Lib/hotpdf_abi.h Lib/hotpdf_abi_form_data.h "$package/include/"

Preserve the library bytes when copying the package to the deployment host. The deployment check verifies that the ELF machine type matches the host. The deployment guide (Tests/Linux/LinuxDeployment.en-us.md) records the compiler, source and ELF identities

Check the staged library on the deployment host

On the deployment host, retain the Tests/Linux relative path for the three files Build-LinuxDeploymentFixture.py, Run-LinuxDeploymentAcceptance.sh and linux_abi_client.c. Run the commands from the directory containing Tests. The focused check uses Python 3, GCC, binutils, file, ldd and timeout

python3 Tests/Linux/Build-LinuxDeploymentFixture.py /absolute/path/fixtures

HPDF_DEPLOYMENT_CORE_ONLY=1 \
HPDF_DEPLOYMENT_HEADERS=/absolute/path/package/include \
HPDF_DEPLOYMENT_OUTPUT=/absolute/path/check-output \
HPDF_REQUIRE_NO_TEXTREL=1 \
sh Tests/Linux/Run-LinuxDeploymentAcceptance.sh \
  /absolute/path/package/libhotpdf.so.1 /absolute/path/fixtures

Put NativeCMapDataLicense.html beside the ELF and the two public headers under package/include. The fixture generator creates source.pdf and refuses to overwrite an existing fixture. Use the repository and its complete fixture set for the full acceptance profile

The repository also provides a focused timestamp signing check. For broader feature validation, use Tests/Linux/Run-LinuxABIAcceptance.sh from the repository checkout with the same toolchain and a fresh output directory. The full acceptance runner and its fixtures are repository assets

The full acceptance Python environment needs pypdf with its AES provider, cryptography, PyMuPDF, Pillow and NumPy; the full sequence also requires a C compiler, timeout, OpenSSL 3, Cairo/FreeType, Fontconfig, installed Unicode TrueType fonts, HarfBuzz, FriBidi, Tesseract with English trained language data and Little CMS 2

The existing font repair and PDF/A checks additionally require Ghostscript with substitute fonts, util-linux prlimit, a headless Java runtime and the official veraPDF CLI JAR; see native workflow dependencies and archival font repair configuration; the full runner does not skip these checks when a dependency is absent

FPC_EXE, HPDF_LINUX_OUTPUT, and PYTHON_EXE select tool locations; the default acceptance Python environment is /opt/hotpdf-python/bin/python

FPC normally writes an anonymous export block into its ELF linker response; the build names that block using the checked-in symbol map before linking, because adding a second named version script would conflict with the anonymous block

Public interface

Include Lib/hotpdf_abi.h for the shared record layout and status constants; hpdf_abi_io_v1_size and hpdf_abi_operation_v1_size report actual native record sizes

The Pascal declarations of the same ABI records are THPDFCABIIOV1, THPDFCABIOperationV1, and THPDFCABISigningOperationV1 for signing jobs that carry a timestamp transport

The Linux library exports ABI discovery, capability discovery, document creation and destruction, callback loading and saving, page counting, hpdf_document_execute_json_v1 and the two-document hpdf_document_compare_json_v1 entry point

Use hpdf_capabilities_json_to_io to discover the operations advertised by the loaded Linux library

The pages.import supplied-font FreeText opt-in is advertised by pageImport.missingFreeTextSynthesis with {"profile":"supplied-font-unicode-v2","fontEncoding":"base64","optIn":true,"styleFonts":["bold","italic","boldItalic"],"maxFontFamilies":16}; the extension adds JSON members and a result counter without changing V1 C callback records, operation records or the public header

OperationBehavior
infoPage, form and signed-field counts
text.extractUnicode page text in JSON and optional UTF-8 output, with an optional zero-based pages array
forms.readFully qualified field names, Unicode values, complete choice selections, types, flags and maximum lengths
forms.fillTransactional text, choice, multiselect, checkbox and radio updates, push-button captions, matching embedded-font appearances and incremental PDF output
forms.removeTransactional AcroForm field removal by fully qualified Unicode field name
annotations.export / annotations.importBounded annotation XFDF exchange with append transactions, exact Unicode, binary streams, popup/reply references, encryption and authenticated certification policy
annotations.removeTransactional annotation removal by page and annotation name, with dependent reply and popup handling
forms.export / forms.importBounded scalar and rich FDF/XFDF interchange with four actual styles per selected configured rich family, encrypted PDF transactions, regenerated appearances, signature policies and synchronous fragmented callbacks
fdf.differences.applyCumulative FDF Differences append with base bytes and SHA-256 binding, held signature policy, exact no-op detection, rollback and same-handle retry
renderCairo PNG output with page, dpi, view or print usage, annotation options and default or alternate optional-content configurations
signIncremental PEM or PFX signing, existing or newly created fields, visible appearances and certification, including authenticated Standard RC4, R4 crypt-filter and AES-256 inputs and digest, metadata, profile and validated evidence options
signatures.verifyActual CMS verification, signed-revision lengths, optional explicit CA trust evaluation and signed revocation information validation
html.importNative HTML/CSS document creation with Unicode fonts, pagination, images, hyperlinks and optional AcroForm controls
text.drawVisible or invisible Unicode page text with preserved original page streams and authenticated encrypted revisions
ocrActual Tesseract recognition with bounded child lifetime, word results and an optional searchable PDF layer
pages.importSelected page resource imports with independent source input and transactional destination updates
pdfa.convertRaster or text/vector PDF/A-4 conversion, with optional font repair and the selected mode's validation requirements
compare / compare.contractTwo-handle page-count, page-text, object-count, rendered-image, structural and full comparison, plus semantic contract comparison with prepared JSON, HTML or annotated PDF review output
{"schemaVersion":1,"type":"render","page":0,"dpi":150,"usage":"print","annotations":false,
 "limits":{"memoryBytes":268435456,"outputBytes":268435456,"pixels":100000000}}

Native signing workflows accept an explicit PEM or Base64 PFX identity, optional new signature fields and Unicode appearances, and certification permissions; successful signing replaces the loaded context with the prepared signed revision, while failed signing or publication preserves the original context

Native signing options bind actual SHA256, SHA384 or SHA512 selection, Unicode signature information, legal attestation, explicit trust bytes, validated signed revocation evidence, real appearance presets, and application-asserted credential or timestamp transport provenance

The optional optional-content viewer state supplies explicit automatic View, Print or Export usage applications, zoom, language, user context and operation-local manual selections through unchanged V1 records

The render operation accepts usage: "view" or usage: "print", defaulting to view; discover the choices through the capability renderUsages array, with unchanged V1 callback and operation records

Annotation screen and printing flags follow the selected usage, and annotations: false suppresses annotations in either mode; omitting optionalContent retains the static default configuration, while an explicit object can select a zero-based alternate configuration with configurationIndex and activate automatic recommendations and operation-local manual selections

Tests/Linux/Run-LinuxABIRenderUsage.sh verifies actual PNG pixels for plain and AES R5/R6 sources, default-off content, callback failures, budgets, cancellation and same-handle recovery; see Tests/Linux/HeadlessRenderUsage.en-us.md for fixture dependencies and the optional pre-generated fixture directory

Callbacks and lifetime

Form appearance options accept Unicode text, export values or complete selection arrays, explicit button states, font settings and transactional resource limits

Read and write callbacks may return partial transfers; successful transfers must make positive progress and must not exceed the requested count

All callbacks execute synchronously on the calling thread, including cancellation checks inside document parsing, rendering and cryptographic checkpoints

Callback input is copied into an exclusively created private temporary file with mode 0600, so Linux input callbacks and their user data need remain valid only until the load or execute call returns

Operations on a shared document handle serialize internally; each active call holds an independent reference, so destroying a handle from a progress callback invalidates subsequent lookup while allowing the current call to finish safely

Do not recursively execute another operation on the same handle from its callback; keep the shared library loaded until all calls have returned and every handle has been destroyed

Budgets and publication

JSON input is limited to 4 MiB and 64 nesting levels, and rejects invalid UTF-8, duplicate members, malformed numeric limits and Int64-to-Int32 parameter truncation

Validated raw UTF-8 text and equivalent JSON Unicode escapes retain the same string values and object-member names without an implicit system-codepage conversion; escaped NUL, U+FFFF and supplementary characters represented by valid UTF-16 surrogate pairs are preserved, while unpaired surrogate escapes fail before document mutation or binary publication

Operation limits include memoryBytes, outputBytes, resultBytes, and pixels; document limits also apply to previously loaded handles, while managed memory and rendering limits do not promise a process RSS cap

PDF and PNG output is fully prepared and checked before output callbacks begin; a caller-owned output callback can retain a partial transfer after its own I/O failure, but failed binary or result publication does not commit form edits or replace a previously loaded context

Successful PDF mutations commit the prepared output as both the current document and its private source snapshot, so a following same-value FDF or XFDF import returns the exact committed PDF bytes with updated=0, retaining earlier form fills, typed rich appearances, drawn text and imported pages

Private staging files are removed when the context is replaced or destroyed; successful incremental form and signature output preserves the original source prefix and encryption policy

hpdf_document_save_to_io performs ordinary PDF serialization and may append a cross-reference revision even without a logical edit; it is not a read-only byte snapshot API and does not bypass authenticated modification checks

The encrypted update and signing profile retains prior committed revisions across successive same-handle signatures and preserves that context when cancellation or output/result callback publication fails

Evidence

Optional archival font repair enables bounded Ghostscript substitution and embedding with genuine PDF/A-4 validation before callbacks

Native annotated review PDF adds actual prepared PDF output, Unicode highlights and authenticated P3 annotation permissions to semantic comparison

Native contract comparison provides bounded two-handle semantic comparison, Unicode review HTML and actual source-line geometry

General native document comparison normalizes object graphs and stream encoding, compares real Cairo pixels with explicit thresholds, and preserves document state and callback publication budgets

The acceptance client verifies real C header layouts and versioned symbol lookup, partial callbacks, 80 concurrent shared-handle operations, cancellation, Unicode edits, rollback and encrypted signing

Independent pypdf, MuPDF and OpenSSL readers verify the actual PDFs, PNG pixels, retained passwords, security dictionaries, document IDs, exact ByteRange gaps, valid signatures and rejection of modified signed bytes

Headless document API · Native rendering · Remaining delivery plan

Deployment evidence by source version

The 2.1211.91 x86_64 WSL deployment (Tests/Linux/LinuxDeployment.en-us.md) used isolated PIC FPC 3.3.1 and the byte-identical staged Enterprise ELF. The standalone C11 kit verified all twelve default HOTPDF_1.0 exports, 48 ABI assertions, and 80 concurrent shared-handle operations. The ELF passed the no-text-relocation and desktop-dependency checks

The 2.1211.54 x86_64 WSL deployment (Tests/Linux/LinuxDeployment.en-us.md) built the committed source with isolated PIC FPC 3.3.1 and ran the standalone C11 kit against the byte-identical staged Enterprise ELF. All twelve versioned exports, 48 ABI assertions and 80 concurrent operations passed

The ARM64 deployment record (Tests/Linux/LinuxDeployment.en-us.md) covers a strict no-TEXTREL build with native FPC 3.3.1 and 48 C ABI assertions plus 80 concurrent shared-handle operations. It also records focused native runs for HTML generation, encrypted page import and Unicode editing, RFC 3161 signing, searchable OCR, and preserving PDF/A-4. Each run identifies the tested ELF and the independent output checks

The 2.1210.39 Enterprise Linux deployment (Tests/Linux/LinuxDeployment.en-us.md) verified all twelve HOTPDF_1.0 exports and passed 48 C ABI assertions and 80 concurrent operations. The focused C11 client used only the packaged headers and ELF to query capabilities, save through callbacks, and reopen and compare the saved document on a separate handle

The 2.1210.21 Linux checks (Tests/Linux/LinuxDeployment.en-us.md) rebuilt the versioned ELF and passed 36 C ABI assertions and 80 shared-handle operations under Ubuntu x86_64 WSL. The same checks passed from a reconstructed Enterprise installation layout without the English help directory. The native Pascal XFA probe has its own result in that record

The 2.1210.19 WSL deployment (Tests/Linux/LinuxDeployment.en-us.md) used FPC 3.3.1-20818-ga205e76e12-dirty on Ubuntu 26.04.1 x86_64. The staged ELF passed strict relocation and dependency checks, 36 C ABI assertions and 80 concurrent operations. The Enterprise deployment kit also passed the focused check with that staged ELF using its standalone fixture

The 2.1208.9 physical-host deployment (Tests/Linux/LinuxDeployment.en-us.md) used Ubuntu 26.04.1 x86_64 and FPC 3.3.1-20818-ga205e76e12. A C11 client built against the staged public header loaded the byte-identical isolated-PIC ELF with SONAME libhotpdf.so.1 and versioned HOTPDF_1.0 exports. The no-text-relocation check, 36 ABI assertions and 80 concurrent operations on a shared handle passed

This deployment check covered callback I/O, text extraction, comparison, cancellation and the handle lifecycle. For OCR, signing and PDF/A acceptance, see the source-specific records below

The 2.1210.5 WSL workflow records (Tests/Linux/LinuxDeployment.en-us.md) identify the separate staged ELF used for actual OCR, preserving PDF/A-4, successive encrypted signatures, and HTML generation followed by encrypted page import and Unicode editing

The post-split Linux acceptance record (Tests/CABI/EditionSplitABI/LinuxAcceptance.json) binds source d4ae3610ed, FPC 3.3.1-20818-ga205e76e12-dirty and an isolated-PIC ELF to passing symbol-version, SONAME, no-text-relocation and no-desktop-dependency checks, actual C layouts and lifecycle calls, and one two-page pdfa.convert raster operation

That focused record validates the relocated entry and its archival path; it does not repeat the complete OCR, HTML, preservation or signing sequence, and the earlier broader runs retain their own source and ELF identities

The 2.1092.39 physical-host acceptance (Tests/Linux/CurrentSourceAcceptance/V2109239PIC/Acceptance.json) records Ubuntu 26.04.1 x86_64 with FPC 3.3.1-20818-ga205e76e12, 22 passing ABI groups and 11 passing same-ELF deployment groups, including real OCR, genuine PDF/A validation and independent saved-output checks

The source composition starts at 50db2c64627a46e3f29e83a9eaace9ddbc6631e4 with the recorded OCR and verifier/fixture overlays; the receipt identifies the compiled product source as equivalent to 0d136ef29a83f3907002badac24b2d86a38386b4. Both gate runs identify ELF SHA-256 bf4dc82d3d1d5213a9338128c5f968eeb0aac7e4b767d998785003d63c18b745

After the initial user-level engine-bundle run, a system-default Java, Tesseract and veraPDF rerun also passes all 22 ABI and 11 deployment groups without engine-path overrides; its two retained logs match the hashes in the receipt

The physical ABI build log records creating DT_TEXTREL from the installed RTL. Earlier no-TEXTREL WSL isolated-PIC results belong to their own ELF identities and must not be attributed to this physical build. The remote ELF and source manifest are not mirrored in this documentation review, and these historical executions do not establish a current-HEAD or historical full-matrix rerun

The version 2.1000.0 focused Linux ABI and same-ELF deployment record (Tests/Linux/CurrentSourceAcceptance/V210000Focused/Acceptance.json) binds committed source dec1795a60299131899bdeb0ebe210aeca7822f5 to a fresh x86_64 library built with FPC 3.3.1-20818-ga205e76e12-dirty on Ubuntu 26.04.1 under WSL, using the accepted isolated PIC units; both the build and copied-package clients run against identical ELF bytes without text relocations

Each location passes 36 public-header C assertions and 80 shared-handle text-extraction operations, plus focused JSON HTML imports, saved and resaved PDF checks and failed-publication recovery; the deployment C client uses the copied header, and callback failure may retain partial caller-owned output bytes while preserving the old document

This focused execution does not repeat the complete shipped ABI sequence, encryption, signing, OCR, PDF/A, the historical distribution matrix or the full library regression suite; earlier complete executions keep their original source identities, and broader layout, rendering, shaping and dynamic XFA work remains active

The version 2.995.4 ABI and copied-package deployment record (Tests/Linux/CurrentSourceAcceptance/V29954/Acceptance.json) binds the committed runtime source at 593fd6155dff215425898c3b843dd883aceafd04, a fresh x86_64 library and the identical ELF loaded from a separate package directory; deployment C clients compile against that package's copied header

The actual compiler was FPC 3.3.1-20818-ga205e76e12-dirty on Ubuntu under WSL, using the previously accepted isolated PIC units; the library has no DT_TEXTREL or DF_TEXTREL, and the complete committed ABI sequence and independent readers ran against that library

This evidence is specific to that version, source composition, compiler build and host; it does not establish a result for later source changes, every later FPC compiler, other distributions or architectures, the full library regression suite, or completion of the broader goal

A fresh full Linux ABI run and deployment run passed against the exact formal 2.993.11 source composition; the current-source acceptance record (Tests/Linux/CurrentSourceAcceptance/V299311/Acceptance.json) binds the actual receipts, compiler build, locales and shared ELF identity

The complete sequence retains C and Python callback clients, concurrent handle operations, cancellation and rollback, HTML and page imports, signing and CMS readback, font repair and PDF/A validation, OCR at all four page rotations, and explicit C and C.UTF-8 text extraction controls

Deployment uses the identical accepted ELF in a fresh fixture and output tree with independent verifiers enabled; the library is not recompiled for deployment, while the deployment clients are compiled and exercised

Earlier V29936 receipts remain historical evidence for their original source and compiler identities; successful finite checks do not establish every Linux distribution, every locale, complete operating-system module closure, general CSS or XFA support, or the overall completion goal

A separate isolated PIC acceptance record (Tests/Linux/CurrentSourceAcceptance/V299311PIC/Acceptance.json) binds a fresh complete ABI run and same-ELF deployment using matching RTL and package units with the external GNU assembler; the observed ELF has no DT_TEXTREL or DF_TEXTREL, and every observed dynamic relocation write fits within a writable load segment

The earlier installed-RTL result keeps its original DT_TEXTREL observation; the isolated PIC result does not relabel that history or establish acceptance for a different compiler build

The reusable isolated PIC unit build procedure (Tests/Linux/LinuxPICUnits.en-us.md) prepares matching units without changing the installed compiler; select its generated product compiler through FPC_EXE and enable HPDF_REQUIRE_NO_TEXTREL=1 for the final library check

The separate public PIC helper acceptance record (Tests/Linux/CurrentSourceAcceptance/V299311PICBuild/Acceptance.json) binds a new unit tree, actual use of its generated compiler entry point, the complete ABI sequence and deployment of the identical accepted ELF

The version 2.995.0 current-source acceptance record (Tests/Linux/CurrentSourceAcceptance/V29950/Acceptance.json) binds committed source, a fresh library build using the completed isolated PIC units, versioned ELF symbols without text relocations, the native ABI and independent-reader sequence, and execution against an identical library copied into a separate deployment package

This run used FPC 3.3.1-20818-ga205e76e12-dirty on Ubuntu under WSL; an initial archive omission of the committed contract-comparison fixtures remains recorded as a preparation failure, and the remaining ABI checks continued against the unchanged library after those fixtures were supplied from the same commit