Pdf - File
Codeunit 5523672 bdev.Pdf - File reads a PDF file that is stored in the app. PDF Files is where a user uploads the documents a stationery or a concatenate configuration refers to - a letterhead, a terms and conditions page, a leaflet - and the same documents are available to your extension.
Code
How a PDF file is resolved
A PDF Files record holds one document and, optionally, one translation per language in PDF File Translations. Which document is returned for a language code follows three rules:
- the record is marked as All Languages, or no language code is asked for - the document of the record itself is returned;
- a translation exists for the language code - the document of the translation is returned;
- no translation exists for the language code - the document of the record itself is returned as the fallback.
A language that has no translation therefore never fails; it falls back to the default document. That is what makes it safe to pass the language of a sales document straight through.
GetPdfFile()
Returns the document of the default language.
Code
Returns the PDF file as a Temp Blob codeunit.
GetPdfFile(Code)
Returns the document of the given language, with the fallback described above.
Code
| Parameter | Type | Description |
|---|---|---|
languageCode | Code[10] | The language of the PDF file. An empty code returns the document of the default language. |
Returns the PDF file as a Temp Blob codeunit.
Both methods return an empty document as of 20.5
Neither overload takes the code of the PDF Files record to read, and the codeunit does not select one either - it reads from an uninitialized record and returns an empty Temp Blob. Until an overload that states which file to read is available, read the file through the PDF Files record itself, as shown below. The resolution rules are the same, they are implemented in the table.
Reading a PDF file today
Code
The document the record returns is the one a stationery configuration would use for the same language, so a letterhead you apply yourself through Pdf - Stationery matches the one the app applies during report processing.


