Business Document Workflows
Internal version 3.434.24, updated 2026-11-18
Small Business adds capture, conversion and review to the core library; Enterprise adds compliance/production, trusted signatures, secure processing and cross-workflow evidence
Process a scan without changing its source
Initialise the selected OCR provider, configure optional preprocessing and explicit limits, then call ProcessPdfScan with a seekable source stream
uses PDFium, FPdfSmallBusiness, FPdfBusinessWorkflows, FPdfReport;
Options := TPdfScanWorkflowOptions.Default;
Options.Ocr.SearchLayer.Dpi := 150;
Options.MaxInputBytes := 64 * 1024 * 1024;
Options.MaxOutputBytes := 128 * 1024 * 1024;
Complete := ProcessPdfScan(Source, Provider, Options, OutputPdf, ScanReport, Token);
JsonReport := ScanReport.ToJson(TPdfReportLimits.Default);
HtmlReport := ScanReport.ToHtml(TPdfReportLimits.Default);
Source, Provider and Token are application-owned input, configured OCR and cancellation interfaces; OutputPdf is a TBytes result and ScanReport is TPdfScanWorkflowReport
Use the Boolean result together with Complete, Cancelled, OutputPublished and per-page outcomes; partial publication is disabled by default and never changes an incomplete result to complete
Successful OCR pages also return structured text and reflow nodes; existing-text pages can be skipped, and table semantics require caller review rather than automatic acceptance
Review two document versions
Call ComparePdfSemantics with explicit category selections and pairing policies, then export PdfSemanticReviewToJson or PdfSemanticReviewToHtml; keep ambiguity visible and use BuildSemanticDiffOverlays for PDF-space annotations
The export preserves incomplete status, before/after values and unresolved identities; visual equality and a lack of reported changes do not establish document equivalence outside the selected comparison scope
Use ReviewPdfSources to retain exact input hashes, selected comparison categories, tolerance and effective page pairing alongside the result; both source streams keep their original positions and the owned documents disable lifecycle actions
Exporting an already-created semantic report requires no native runtime; executing its comparison workflow still requires the selected native engine and valid documents
Assess and migrate static XFA
Call RunPdfXfaMigration with AssessmentOnly=True to exercise the bounded converter without publishing its candidate; inspect the field map and rejection reason, then run conversion with AssessmentOnly=False when appropriate
TPdfXfaFlattenField.AcroFormName records the exact target name, including subform qualification where duplicate leaf names require it; report page numbers are one based and field values are omitted from JSON/HTML
Assessment consumes conversion resources and returns the first rejection; native V8/XFA scripts and dynamic layouts have separate runtime support and are not converted by this workflow
Choose a raster or searchable output branch
PDF/R markers and validation are included in Small Business and Enterprise through FPdfPdfrEngine since 3.266.0; preserve supported raster-only pages for transport, or choose a searchable OCR PDF as a separate output
PDF/R does not permit the searchable text layer added by OCR, and marker injection does not repair arbitrary page content into the raster profile
For exact saved-byte validation, call ValidatePdfRasterSource with TPdfRasterSourceValidationOptions.Default; it combines raw-file validation and native page facts against one original-byte snapshot
A true return means validation completed; Report.IsCompliant additionally requires no conformance issues. The existing TPdf.ValidatePdfR still checks a native reserialisation, which can omit original footer markers, and therefore keeps a different scope
Input/page/object budgets and cooperative cancellation remain explicit; native/parser internals and independent certification retain their documented limits
Attach Enterprise evidence
After observing an operation's result, fill TPdfWorkflowEvidenceContext with its profile, independently checked prerequisites, actual module/provider identities, policy and resource budget, then call AppendPdfWorkflowEvidence with the exact input/output bytes
Export the evidence as JSON or HTML alongside the operation's own preflight, trust, redaction or tagging report; computed byte identities do not replace independent verification of the supplied environment and outcomes
HTML and JSON expose the same operation context, including readiness, actual implementation linkage, prerequisite checks, byte counts and opt-in flags
Deliver reports and artifacts together
Since 3.268.0, raster inspection includes page-specific issues, processed counts and a structured completion status; scan, review, raster, XFA and Enterprise evidence records can serialise directly with WriteJson and WriteHtml
Workflow snapshots spill after 8 MiB by default, preserving source positions whilst native documents load from owned streams; storage thresholds do not bound native/provider allocations or returned PDF byte arrays
TPdfArtifactBundle stages PDF and report streams, checks their hashes and publishes a new Windows directory with manifest.json; an existing destination is never replaced
Enterprise typed evidence distinguishes documents, diagnostics and successful read-only inspections, and can verify recorded byte identities without claiming independent authentication
Build and run the WorkflowConsole example for Small Business or Enterprise to exercise raster inspection, two-source review and Tesseract OCR with bounded reports and an artifact manifest
Query capability before execution
QueryPdfFeatureProfile separates native XFA interaction from unsupported dynamic conversion and describes font instances, bidirectional paragraphs, encrypted form writes, business workflows, PDF/R and trusted evidence
Queries never execute a workflow or discover document semantics; supply checks for the exact selected profile and let the operation enforce its own options and input validation