CreateInvoiceRulePackage

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, an empty string or False and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)

E-invoicing

Description

Turns a directory holding a schema, a compiled Schematron stylesheet and their supporting files into a rule package by writing a rulepackage.xml manifest with the SHA-256 of every file

Syntax

Delphi

Function TPDFlib.CreateInvoiceRulePackage(Const Directory, Standard, RulesVersion,
  RulesProfile, Syntax, SchemaFile, SchematronStylesheetFile: WideString): WideString; Virtual;

ActiveX

Function PDFlib::CreateInvoiceRulePackage(Directory As String, Standard As String, RulesVersion As String, RulesProfile As String, Syntax As String, SchemaFile As String, SchematronStylesheetFile As String) As String

DLL

const wchar_t* DLCreateInvoiceRulePackage(int InstanceID, const wchar_t* Directory, const wchar_t* Standard, const wchar_t* RulesVersion, const wchar_t* RulesProfile, const wchar_t* Syntax, const wchar_t* SchemaFile, const wchar_t* SchematronStylesheetFile);
const char* DLCreateInvoiceRulePackageA(int InstanceID, const char* Directory, const char* Standard, const char* RulesVersion, const char* RulesProfile, const char* Syntax, const char* SchemaFile, const char* SchematronStylesheetFile);

Parameters

ParameterDescription
DirectoryThe package directory; every file below it except an existing manifest is listed
Standard, RulesVersionThe standard and the rule release, both required
RulesProfile, SyntaxOptional profile and syntax names, such as EN16931 and CII
SchemaFile, SchematronStylesheetFileThe schema and the compiled Schematron stylesheet relative to Directory; at least one is required

Return values

The package information as JSON, as returned by GetInvoiceRulePackageInfo; sha256 is the digest to pin in later validations

Remarks

Run it once when you approve a rule release, keep the returned digest with your configuration and pass it to ValidateInvoiceBusinessRulesWithPackage; any later change to a package file or the manifest then stops validation

Example

Writeln(PDF.CreateInvoiceRulePackage('C:\Rules\EN16931-CII-1.3.16', 'EN16931', '1.3.16',
  'EN16931', 'CII', 'schema/FACTUR-X_EN16931.xsd', 'schematron/EN16931-CII-validation.xslt'));

See also

GetInvoiceRulePackageInfo, ValidateInvoiceBusinessRulesWithPackage