SaveVisualComparisonPDFA

Small Business, visual comparison

Requires the Small Business edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibSmallBusiness (unit PDFlibSmallBusiness) or TPDFlibEnterprise; the Small Business and Enterprise DLL and ActiveX builds provide it unchanged; the Single edition keeps the method, which returns an empty string and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to SaveVisualComparisonPDF and string arguments are interpreted using the current SetAnsiMode code page

Compares the selected document against a baseline and saves a separate review PDF containing both sides of each page pair, with red difference frames on current pages and blue frames on baseline pages

Syntax

Delphi

Function DLSaveVisualComparisonPDFA(InstanceID: Integer; BaselineFileName: PAnsiChar; BaselinePassword: PAnsiChar; OptionsJSON: PAnsiChar; OutputFileName: PAnsiChar): PAnsiChar;

DLL

const char* DLSaveVisualComparisonPDFA(int InstanceID, const char* BaselineFileName, const char* BaselinePassword, const char* OptionsJSON, const char* OutputFileName);

Options

An empty options string uses the defaults below; unknown properties, noninteger values and out-of-range values fail before output is written

{"dpi":96,"colorTolerance":0,"tileSize":32}
OptionRangeMeaning
dpi72 to 300Resolution used to compare rendered page appearances
colorTolerance0 to 255Per-channel pixel difference tolerance
tileSize4 to 128Pixel tile size used to group changed regions

Progress, cancellation and budgets

Typed OnOperationProgress and classic OnProgress events are forwarded to the calling instance; Abort is observed at safe points and during supported native rendering, with one terminal workflow phase

Options additionally accept maxRasterPixels, default 134217728, and maxOutputBytes, default 536870912; both are integers from 1 through 536870912

Pixel work is estimated from both sets of source-page geometry before rendering and checked against actual rendered dimensions; output writes are bounded before exceeding the byte limit

Cancellation returns status:"cancelled", complete:false and error 907 without publishing a partial review PDF; call ResetAbort before starting another workflow on a cancelled instance

Return values

Returns JSON with status, complete, the original structured comparison, a source-to-output pages map, the actual runtimeBackend ID, rectangleCount, output file name, byte count and SHA-256

Successful output has status:"ok" and complete:true; errors return status:"error", complete:false and error 906, without publishing a partial review PDF

Single instances return an empty string with error 901; Small Business and Enterprise implement the operation; ActiveX exposes it through IPDFlibrary9 or CoPDFlibrary.CreateEditionTools9; Dylib exposes the same wide and ANSI names with cdecl

Page geometry and limits

The comparison uses each page's CropBox at the requested DPI; copied pages retain vector content, page boxes, rotation and UserUnit, and pixel regions are mapped back into source-page coordinates

Page additions and removals are defined from baseline to current, with direction:"baseline-to-current" in the comparison; missing partners and size changes receive whole-visible-page frames; page labels identify the source side, source page and pair; unchanged paired pages remain available for review

Each input supports 1 to 256 pages and a 256 MiB serialized source limit; difference regions are bounded to 4096 per page, and the output is limited to 512 MiB

The selected document, font and drawing settings, modification metadata and rendering settings are retained; output requires a new local .pdf path and never replaces an existing file; a compatible selected rendering backend must be available

This is a raster appearance review at one resolution, with fullCertification:false; it does not establish semantic equivalence, preserve signature validity in the review copy, or certify standards conformance

Example

Report:= PDF.SaveVisualComparisonPDF('baseline.pdf', '',
  '{"dpi":144,"colorTolerance":0,"tileSize":32}', 'visual-review.pdf');

Run the shared workflow CLI example through the Delphi, Lazarus or C++Builder entry for the required edition, including progress and batch cancellation

TRIAL delivery retains the evaluation watermark on temporary output objects; batch conversion applies it before format conversion so raster output contains the mark inside its image data, while internal source snapshots remain unchanged

See also

CompareDocumentVisualsWith · SaveTextComparisonPDF · GetFeatureAvailability · Edition comparison