function SaveAsPdfR(const FileName: string): Boolean; overload;
function SaveAsPdfR(const FileName: string; const Options: TPdfRSaveOptions): Boolean; overload;
SaveAsPdfR performs the regular SaveAs first, then layers an incremental update on top of the saved bytes that attaches PDF/R-1 file-format markers. PDF/R-1 (ISO 23504-1:2020) is the strict raster-image transport subset of PDF used by the TWAIN Working Group for scanned document workflows; it carries a fixed-size raster buffer per page, supports bitonal / greyscale / RGB images and FlateDecode / CCITTFaxDecode / DCTDecode compression only.
The post-processing injects five classes of bytes into the saved stream:
%PDF-raster-1.0 version-identification comment, written between the trailer dictionary and the startxref keyword (ISO 23504-1 §5). This is unique to PDF/R — the other PDF/x standards identify themselves through XMP and Info-dictionary entries instead.The output stays byte-identical to the base SaveAs result up to
the end of the original PDF; only the incremental update is
appended (and the source catalog / Info are replaced with stripped
versions via same-object-number rewriting). The two overloads
differ only in how the configuration is passed in: the file-name-
only form uses TPdfRSaveOptions.Default with
auto-population of the four Info fields and DocumentId from
FPDF_GetMetaText / FPDF_GetFileIdentifier.
Returns True on success.
[0 0 w h], only FlateDecode / CCITTFaxDecode (bitonal) / DCTDecode (8-bit grey or RGB) filters are allowed, no object streams, every indirect reference must have generation number zero, and each page is essentially a single raster image. PDFium-generated documents that already match this pattern (e.g. scanner output passed through PDFium for repackaging) work well; arbitrary content-rich PDFs typically do not.TPdfRSaveOptions.StripCatalogOptionalEntries and StripInfoOptionalEntries default to True; set them False if you want the injector to preserve all source entries (the output then won't meet §6.3 / §6.4.3 but the version marker and XMP are still attached).%PDF-2.0 header and AES encryption. PDFium-generated PDFs use a 1.x header so encrypted output isn't a PDF/R-1 candidate without further re-saving.
// Simple PDF/R-1 output; only meaningful when the source PDF is
// already a raster scan (one image per page, allowed filters only).
if Pdf1.SaveAsPdfR('C:\Scan.pdfr.pdf') then
ShowMessage('Saved with PDF/R-1 markers');
// Validate to see whether structural rules are also satisfied
Pdf1.FileName := 'C:\Scan.pdfr.pdf';
Pdf1.Active := True;
if Pdf1.ValidatePdfR.IsCompliant then
ShowMessage('PDF/R-1 conformant');