Skip to content

PDF render options

PdfRenderOptions configures the PDF renderer. Pass it to RenderAsPdf:

byte[] pdf = document.RenderAsPdf(new PdfRenderOptions { Standard = PdfStandard.PdfA4 });

Type: PdfStandard - default: PdfStandard.PdfA2

Selects the PDF standard the output conforms to:

Value Produces PDF version
PdfA2 PDF/A-2b 1.7
PdfA3 PDF/A-3b (file attachments permitted) 1.7
PdfA4 PDF/A-4 2.0
Pdf20 Plain PDF 2.0, no archival profile - the only standard that permits encryption; attachments permitted 2.0

See the PDF/A guide for choosing between them.

Type: IReadOnlyList<PdfAttachment> - default: empty

Files to embed into the PDF. Each PdfAttachment carries the file name (ASCII, unique per document), the raw bytes, a MIME type, the /AFRelationship (DATA, SOURCE, ALTERNATIVE, SUPPLEMENT, UNSPECIFIED), and an optional description. Requires Standard = PdfStandard.PdfA3 or PdfStandard.Pdf20 - any other standard throws at render time, and the bundled Roslyn analyzer flags the literal-initializer case at compile time as PAPY101.

Type: FacturXOptions? - default: null

Turns the output into a ZUGFeRD/Factur-X hybrid e-invoice: new FacturXOptions(xmlBytes, FacturXProfile.En16931) embeds the invoice XML as factur-x.xml and writes the Factur-X XMP extension schema. Requires exactly PdfStandard.PdfA3 (not Pdf20 - the extension schema needs the PDF/A machinery). See the e-invoicing guide.

Type: PdfEncryption? - default: null

Encrypts the output with AES-256 (PDF 2.0 standard security handler, /V 5 /R 6). PdfEncryption carries UserPassword (required to open; null/empty means the document opens without one), OwnerPassword (full access; null means the user password doubles as it), and Permissions (a PdfPermissions flags value, default ALL) - at least one password must be non-empty. Requires Standard = PdfStandard.Pdf20, because PDF/A forbids encryption; any other standard throws at render time, and the analyzer flags the literal-initializer case as PAPY106. Encrypted output is not byte-deterministic (random keys, salts, and IVs). See the encryption guide.


That’s the whole surface today - the options record is deliberately small.