int32_t __stdcall pdfCheckConformance(PPDF IPDF, int32_t ConfType, uint32_t Options, void* UserData, TOnFontNotFoundProc OnFontNotFound, TOnReplaceICCProfile OnReplaceICCProfile);
function pdfCheckConformance(const IPDF: PPDF; ConfType: Integer; Options: Cardinal; const UserData: Pointer; OnFontNotFound: TOnFontNotFoundProc; OnReplaceICCProfile: TOnReplaceICCProfile): Integer; stdcall;
Purpose. A dual-purpose function: (1) arm the output document's target conformance level (PDF/A-1b through PDF/A-4f, and — sharing the exact same ConfType switch — every PDF/X flavor too, see V13), which shapes how the document is subsequently serialized; and (2), if an import source file is currently open, genuinely validate that source against the chosen level's real rules and report an actual violation count.
Description. Part 1 (write-side arming, CheckConformance): a large case ConfType of switch maps every TConformanceType ordinal to a real (Part, Conformance-letter, PDF-version) triple — e.g. 0 (ctPDFA_1b_2005) → Part 1/'B'/PDF 1.4; 20 (ctPDFA_4) → Part 4/''/PDF 2.0; the accessibility ("a") levels (25-27) use an identical Part/version mapping to their b/u counterparts, differing only in the XMP conformance letter — "Tagging itself is the caller's job (structure tree API); like the classic API, create-mode trusts the author here" (this function does not itself verify the document is actually tagged for an "a"-level target). The same switch also handles PDF/X ordinals (23, 24, 28..37): selecting one forcibly disables encryption (FEncryptDoc := False — PDF/X forbids it, same as PDF/A) and sets FPdfXVer/FPdfVersion, which the serializer later uses to emit the GTS_PDFXVersion XMP entry, the /GTS_PDFX output intent, and /Trapped. Part 2 (import-side real validation, CheckImportConformance): only runs if the write-side arming call itself returned 0 (no immediate error) and an import file is open; it is a genuinely substantial rule-checker — the checks include: encryption forbidden (code 1), missing catalog /Metadata XMP stream (code 2), font-embedding requirements (HasFontFile checks against /FontFile/FontFile2/FontFile3, invoking OnFontNotFound per non-embedded font found), and forbidden LZWDecode filter usage (PDF/A disallows LZW) — mapped per-Part since transparency and embedded-file rules genuinely differ across PDF/A-1 through -4 (ZUGFeRD/Factur-X ordinals 4..17 are treated as riding on PDF/A-3's rule set). Each violation is recorded as a (Code, Message) pair, retrievable via pdfGetConformanceViolation(Count) below.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
ConfType | The target TConformanceType ordinal — covers both PDF/A and PDF/X flavors in one shared enum/switch. |
Options | Passed through to the import-side validator; specific option bits not enumerated in this chapter. |
UserData | Opaque context pointer passed to both callbacks. |
OnFontNotFound | Invoked once per non-embedded font found during import-side validation. |
OnReplaceICCProfile | Invoked to let the caller substitute an ICC profile during validation (e.g. for a document missing/using an incompatible output-intent profile). |
Return value. -1 if IPDF is invalid. Otherwise: the write-side arming's own result if non-zero (an immediate configuration error); else, if an import file is open, the violation count found by the real import-side validator (0 = passed with no violations found).
C# (P/Invoke)
public static extern int pdfCheckConformance(IntPtr IPDF, int ConfType, uint Options, IntPtr UserData, TOnFontNotFoundProc OnFontNotFound, TOnReplaceICCProfile OnReplaceICCProfile);
Validation
pdfCheckConformance
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.