Pdf - Stationery
Codeunit 5523673 bdev.Pdf - Stationery applies a stationery - a PDF document that is laid under the pages of another PDF - to a document of your own. It is what the app itself uses when a report selection carries a stationery configuration, so a document you process this way looks exactly like one the app processed.
There are two ways to state which stationery to apply:
- a stationery document, passed as a
Temp Blob. It is laid under every page. - a stationery configuration, a
bdev.Pdf Stationery Config.record. The configuration states a PDF file per page position - first page, following pages, second last page, last page, or all pages - and whether it applies to the print intent at hand.
Code
ApplyStationeryToDocument(Codeunit, Codeunit)
Applies a stationery document to every page of a PDF document.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The PDF document. It is replaced by the result. |
stationery | Codeunit "Temp Blob" | The stationery document. |
Example
Code
ApplyStationeryToDocument(Codeunit, Record)
Applies the page settings of a stationery configuration to a PDF document, with the print intent Print.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The PDF document. It is replaced by the result. |
pdfStationeryConfig | Record "bdev.Pdf Stationery Config." | The stationery configuration to apply. |
Example
Code
Letting the user pick the configuration works the same way as anywhere else:
Code
ApplyStationeryToDocument(Codeunit, Record, Code)
Applies the page settings of a stationery configuration in a given language, with the print intent Print.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The PDF document. It is replaced by the result. |
pdfStationeryConfig | Record "bdev.Pdf Stationery Config." | The stationery configuration to apply. |
languageCode | Code[10] | The language of the stationery. |
The language decides which PDF file the configuration resolves to. A PDF file marked as All Languages is used regardless of the language code, and so is the default file when no translation exists for the language - see Pdf - File.
ApplyStationeryToDocument(Codeunit, Record, Enum)
Applies the page settings of a stationery configuration for a given print intent.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The PDF document. It is replaced by the result. |
pdfStationeryConfig | Record "bdev.Pdf Stationery Config." | The stationery configuration to apply. |
documentPrintIntent | Enum "bdev.Pdf Document Print Intent" | Print, Preview, Download or Save. |
ApplyStationeryToDocument(Codeunit, Record, Enum, Code)
The full overload: a stationery configuration, a print intent and a language.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The PDF document. It is replaced by the result. |
pdfStationeryConfig | Record "bdev.Pdf Stationery Config." | The stationery configuration to apply. |
documentPrintIntent | Enum "bdev.Pdf Document Print Intent" | Print, Preview, Download or Save. |
languageCode | Code[10] | The language of the stationery. |
The print intent decides whether anything happens
A stationery configuration carries a Perform on ... switch per print intent. When the switch of the intent you pass is off, the method returns without applying anything and without an error - the same behavior the app shows when a user previews a document whose stationery is configured for printing only.
A silent return is not a failure
The overloads that take a configuration return nothing, and a disabled configuration is indistinguishable from an applied one at the call site. If your process depends on the stationery having been applied, read the Perform on ... field of the configuration before you call, or compare the document size afterwards.
The overload that takes a stationery document rather than a configuration has no such switch and always applies the stationery.


