ExecuteVCRDataMergeA
Compliance, variable content, document editing
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 0 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 ExecuteVCRDataMerge and string arguments are interpreted using the current SetAnsiMode code page
Executes an ISO 16613-1 (PDF/VCR-1) variable content replacement merge on an external template PDF and writes the merged document to a file
JSON field names and values use standard JSON string escapes, including Unicode escapes; an explicit empty string clears its placeholder, while an absent field leaves its placeholder unchanged; failed merges preserve an existing output file
Syntax
Delphi
Function DLExecuteVCRDataMergeA(InstanceID: Integer; FieldValuesJSON: PAnsiChar; Options: Integer): Integer;
DLL
int DLExecuteVCRDataMergeA(int InstanceID, const char* FieldValuesJSON, int Options);
Parameters
| InputFileName | Full path of the PDF/VCR template to read |
|---|---|
| Password | Password used to open the template, or an empty string for an unencrypted file |
| FieldValues | Key-value pairs (Key=Value separated by semicolons or newlines, or a JSON object) mapping declared GTS_Data field names to replacement text |
| OutputFileName | Destination file path for the merged PDF output |
Return values
1 when the chosen merge contract completes successfully, otherwise 0; external-file methods write OutputFileName, while current-document methods select a new merged document
Remarks
The original entry points, PDFlib::ExecuteVCRDataMerge in ActiveX and DLExecuteVCRDataMerge in the DLL and the Dylib, merge the currently selected template and select a new merged document, preserving the original document; Options must be zero, and ExecuteVCRDataMergeCurrent documents that contract
ExecuteVCRDataMergeEx, reached from ActiveX as PDFlib::ExecuteVCRDataMergeEx and from the DLL and the Dylib as DLExecuteVCRDataMergeEx, exposes the complete external-file contract this page describes
Each placeholder structure element carrying a GTS_Replacement attribute dictionary and matching GTS_Data field name has its corresponding marked-content sequence (/Span << /MCID ... >> BDC ... EMC) updated in the page content stream
A missing input file or empty output path sets LastErrorCode 401; a template validation or merge failure sets LastErrorCode 608
Field values keep their full Unicode text and are written with the font in effect at each placeholder; a JSON null value clears the placeholder, and a value containing a character the template font cannot display fails the merge with LastErrorCode 608 while leaving an existing output file untouched
See also
ExecuteVCRDataMergeCurrent, BeginPDFVCRTemplate, BeginPDFVCRPlaceholder, GetPDFVCRManifest