Skip to main content
MagentoMay 29, 20256 min read

Magento 2 EU-Compliant Invoice PDF with Translations

Magento 2 does not print the invoice date on PDF invoices or translate them per store view. Our PdfOverride module adds EU-compliant invoice dates and automatic store-based translations.

Magento 2 Invoice PDF That Speaks Your Customer's Language

If you're managing a multilingual Magento 2 store, you've likely optimized your frontend experience in various languages -- but what about the backend? More specifically, are your invoice PDFs compliant and correctly localized?

By default, Magento does not print the invoice creation date on PDF invoices, and does not translate PDFs based on the store the order was placed in. This is not only a UX issue -- in the EU, it's a legal problem.

Our Solution: PdfOverride Module

Our custom Magento 2 module, PdfOverride, solves these problems by:

  • Adding Invoice Date and Order Date to the header
  • Translating phrases using Magento's i18n/*.csv structure
  • Dynamically setting the correct locale based on the order's store
  • Providing a minimal override with maximum impact

Compatibility

  • Magento 2.4.8
  • Tested on 2.4.8
  • Works with multi-language, multi-store setups

Admin vs Customer Language

Previously, the PDF output used the admin panel language. With this module, the invoice language now follows the store view the customer used during checkout -- correctly localizing all fields.

Why You Need This

  • Legally required fields (Invoice Date)
  • Localized PDFs improve UX and reduce tax/legal risks
  • Easy to maintain, built with Magento's best practices

Why Is Invoice Date Required?

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

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

Missing the invoice date? That's grounds for rejection during audits or B2B transactions.

Multi-Language Support

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

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 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 the order was placed in.

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 and Source

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

Final Thoughts

Complying with EU invoice rules doesn't need to be hard. This module gives your Magento store a professional, legally-compliant, multilingual invoicing experience -- essential for modern e-commerce.

Need further customizations or support? Our Magento speed optimization service covers full infrastructure and module support for Magento 2 stores.

Need help with this?

Our team handles this kind of work daily. Let us take care of your infrastructure.