function ValidatePdfR: TPdfRValidationResult;
ValidatePdfR walks the open document looking for the file-format markers defined by ISO 23504-1:2020:
%PDF-raster-x.y version-identification comment near the end of the file (§5).%PDF-1.4, %PDF-1.5, %PDF-1.6, or %PDF-1.7 (§6.2.2) for unencrypted files, or %PDF-2.0 (§6.2.3) for encrypted files./Type /ObjStm — §6.2.4).pvriProhibitedCatalogEntry).pvriProhibitedInfoEntry)./ID array.The result is a TPdfRValidationResult record:
prc1 (PDF/R-1 marker found), prcNone (no marker), or prcUnknown (parse failed or document inactive).TPdfRValidationIssues set with zero or more values: pvriMissingVersionMarker, pvriBadHeader, pvriObjStmPresent, pvriProhibitedCatalogEntry, pvriProhibitedInfoEntry, pvriInfoXmpMismatch, pvriMissingXmpMetadata, pvriMissingTrailerId.ValidatePdfR is a read-only file-format inspection. PDF/R-1 compliance has strict structural requirements that this method does not check — per-page Contents structure, MediaBox form, allowed filters, generation-zero indirect references, strip layout. Pair with a TWAIN Working Group PDF/R validator for those content-level checks.
%PDF-raster- as a substring anywhere in the file. ISO 23504-1 §5 specifies the marker is placed between the trailer dictionary and startxref, but the validator accepts other locations to remain forgiving of slightly non-standard generators.Conformance = prcUnknown and an empty Issues set.%PDF-2.0 header), so the validator does NOT flag the trailer /Encrypt key as a non-conformance. Source PDFs encrypted under PDF 1.x would still fail because of the header check.
uses System.TypInfo;
var
Outcome: TPdfRValidationResult;
Issue: TPdfRValidationIssue;
begin
Pdf1.FileName := 'C:\Incoming\scan.pdf';
Pdf1.Active := True;
Outcome := Pdf1.ValidatePdfR;
Memo1.Lines.Add('Level: ' + GetEnumName(TypeInfo(TPdfRConformance),
Ord(Outcome.Conformance)));
for Issue in Outcome.Issues do
Memo1.Lines.Add('- ' + GetEnumName(TypeInfo(TPdfRValidationIssue), Ord(Issue)));
end;