📄 PDF Generator and Email Attachments
The PDF Generator and Email Attachments module allows automatic attachment of PDF and XML files of KSeF invoices to emails sent from posted sales documents. This way, the invoice recipient receives a visual representation of the KSeF invoice (PDF) and its XML source directly in the email.
Key Features
- Automatic generation of a PDF file from the KSeF invoice based on an XSLT transformation.
- Attachment of the PDF file to emails sent from posted invoices or credit memos.
- Attachment of the KSeF invoice XML file to emails.
- Independent configuration of PDF and XML attachments – ability to enable one or both.
- Optional hiding of the standard invoice PDF report attachment – when the KSeF PDF preview is attached, the standard report can be removed from the message.
Supported Documents
| Document | Supported |
|---|---|
| Posted Sales Invoice | ✅ |
| Posted Sales Credit Memo | ✅ |
| Posted Prepayment Invoice | ✅ |
| Posted Prepayment Credit Memo | ✅ |
How It Works
- The user sends an email from a posted sales invoice or credit memo (standard Business Central functionality).
- The system captures the email sending event and checks the KSeF settings.
- If the document has an associated KSeF outgoing document (NSeI Outgoing Document):
- PDF Attachment – the system retrieves the invoice XML data, applies the XSLT transformation appropriate for the schema version, generates a PDF file with a verification QR code and KSeF number, and then attaches it to the message.
- XML Attachment – the system retrieves the invoice XML data and attaches it directly to the message.
- Files are named according to the pattern:
[DocumentNo]_KSeF.pdfand[DocumentNo]_KSeF.xml.
Configuration
- Search for the KSeF Helper Setup page (or open it from KSeF Settings by clicking the Open KSeF Helper Settings Card link).
- Go to the Email Configuration section.
- Configure the options:
- Attach PDF Preview to Email – enable to automatically attach the KSeF invoice PDF file to emails.
- Attach XML to Email – enable to automatically attach the KSeF invoice XML file to emails.
- Hide Standard Invoice Attachment – enable to remove the standard invoice PDF report from emails when the KSeF PDF preview is attached. This option only works when Attach PDF Preview to Email is enabled.
Both options work independently – you can enable PDF only, XML only, or both attachments simultaneously.
Tips
- The document must have an associated KSeF outgoing document – PDF/XML generation is based on data from that document.
- The PDF file contains the KSeF number (or "OFFLINE" designation if the document has not yet been sent to KSeF) and a verification QR code.
- The XSLT schema version is automatically selected based on the schema code of the outgoing document.
- The feature works only when sending email from posted documents – it does not affect other processes.