Skip to main content

Magento 2 EU-Compliant Invoice Date PDF

5 min read
Fix my Magento PDF invoices

We add the PdfOverride module so invoices print their date and translate per store view.

By default, Magento 2 omits the invoice creation date from PDF invoices and ignores store-level locale settings. Our open-source PdfOverride module adds legally required dates, translates invoice text per store view, and ensures EU VAT Directive compliance out of the box.

Invoice PDFs That Match Your Customer's Language

If you operate a multilingual Magento 2 store, chances are you have invested heavily in localising the frontend. But what about the documents your customers actually keep -- invoices?

By default, Magento does not print the invoice creation date on PDF invoices and does not translate PDF content based on the store view where the order was placed. This is more than a UX oversight: under EU law, it is a legal compliance gap.

Our Solution: PdfOverride Module

We built a custom Magento 2 module called PdfOverride that addresses these shortcomings:

  • Adds Invoice Date and Order Date to the invoice header
  • Translates all phrases using Magento's i18n/*.csv structure
  • Dynamically switches the locale based on the order's store view
  • Provides a minimal override with maximum impact

Compatibility

  • Magento 2.4.8 (tested)
  • Works with multi-language, multi-store setups

Admin vs Customer Language

Previously, PDF output used the admin panel language regardless of which storefront the customer had used. With this module, the invoice language follows the store view the customer selected during checkout, correctly localising every field.

Why You Need This

  • EU regulations require the invoice issue date on every invoice.
  • Localised PDFs improve the customer experience and reduce tax and legal risks.
  • The module is easy to maintain and built with Magento best practices.

Why Is the Invoice Date Required?

EU law (VAT Directive 2006/112/EC, Article 226) mandates that every invoice include:

  • Invoice number
  • Invoice issue date
  • Date of supply (if different)
  • Seller and buyer information

Missing the invoice date can lead to rejection during audits or B2B transactions.

Multi-Language Support

The module supports store-based translations. When a customer places an order in your German store view, the invoice is generated with German text -- not based on your admin user's language.

Example: German CSV Translation

"Order # ","Bestellnummer:"
"Invoice Date: ","Rechnungsdatum:"
"Order Date: ","Bestelldatum:"
"Sold to:","Rechnung an:"
"Ship to:","Lieferung an:"
"Payment Method:","Zahlungsart:"
"Shipping Method:","Versandart:"
"Total Shipping Charges","Versandkosten"
"Title","Sendungstitel"
"Number","Nummer"
"Invoice # ","Rechnung Nr. "

Save this file as:

app/code/Vendor/PdfOverride/i18n/de_DE.csv

Collect phrases automatically with:

bin/magento i18n:collect-phrases -o app/code/Vendor/PdfOverride/i18n/de_DE.csv app/code/Vendor/PdfOverride

How the Locale Is Determined

The PDF generation function uses Magento\Store\Model\App\Emulation to dynamically switch to the store's locale before rendering the PDF. This ensures the correct translation file is loaded based on the store where the order originated.

Installation Instructions

cd app/code
mkdir -p Vendor && cd Vendor
git clone https://github.com/privatedevops/scripts.git
mv scripts/magento2/modules/PdfOverride PdfOverride

bin/magento module:enable Vendor_PdfOverride
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Folder Structure

Vendor/PdfOverride/
├── etc/
│   ├── di.xml
│   └── module.xml
├── i18n/
│   └── de_DE.csv
├── Model/
│   └── Order/
│       └── Pdf/
│           └── Invoice.php
└── registration.php

License & Source

This module is open source under the MIT license. Contributions are welcome.

Download on GitHub

Final Thoughts

Complying with EU invoice regulations does not have to be complicated. This module gives your Magento store a professional, legally compliant, multilingual invoicing experience -- essential for modern eCommerce.

Need further customisations or support? Contact us at Private DevOps.

Frequently asked questions

Why doesn't the Magento 2 invoice PDF show the invoice date?

Magento 2 does not print the invoice creation date on PDF invoices by default. The open-source PdfOverride module adds both an Invoice Date and an Order Date to the invoice header. Under EU rules the issue date is required on every invoice, so the default PDF leaves a legal compliance gap.

Does an EU invoice have to include the invoice date?

Yes. Article 226 of VAT Directive 2006/112/EC requires every invoice to include the invoice issue date, along with the invoice number, the date of supply if different, and seller and buyer information. A missing invoice date can lead to rejection during audits or B2B transactions.

Why are Magento 2 PDF invoices printed in the admin language?

By default, Magento generates PDF content in the admin panel language, whatever storefront the customer used, and does not translate it per store view. With the PdfOverride module, the invoice language follows the store view the customer selected during checkout. An order placed in a German store view then gets an invoice with German text.

How does the PdfOverride module choose the invoice locale in Magento 2?

PdfOverride uses Magento\Store\Model\App\Emulation to switch to the store's locale before the PDF is rendered. That way the translation file for the store where the order originated is the one loaded. Phrases themselves come from CSV files in the module's i18n folder, following Magento's standard translation structure.

How do I translate Magento 2 invoice PDFs into German?

Add a translation file at app/code/Vendor/PdfOverride/i18n/de_DE.csv that maps each English phrase to German, for example "Total Shipping Charges" to "Versandkosten" and "Number" to "Nummer". Phrases can be collected automatically with bin/magento i18n:collect-phrases -o app/code/Vendor/PdfOverride/i18n/de_DE.csv app/code/Vendor/PdfOverride. The PdfOverride module then uses the German file for orders from the German store view.

How do I install the PdfOverride module in Magento 2?

Clone the scripts repository that hosts PdfOverride from GitHub into app/code/Vendor, then move scripts/magento2/modules/PdfOverride to app/code/Vendor/PdfOverride. Enable it with bin/magento module:enable Vendor_PdfOverride and finish with bin/magento setup:upgrade, bin/magento setup:di:compile and bin/magento cache:flush.

Which Magento versions does PdfOverride work with?

PdfOverride has been tested on Magento 2.4.8 and works with multi-language, multi-store setups. The module is a minimal override made of an etc folder with di.xml and module.xml, an i18n folder for translations, Model/Order/Pdf/Invoice.php and registration.php.

Is the Magento 2 PdfOverride module free to use?

Yes, PdfOverride is open source under the MIT license, and contributions are welcome. The source is published on GitHub, so the override can be read in full before it is copied into app/code/Vendor/PdfOverride and enabled with bin/magento module:enable Vendor_PdfOverride.

Read how we handle it in DevOps for e-commerce.