Docs Emboss - PDF Invoices, Credit Notes & Packing Slips for WooCommerce

RTL and CJK documents

From version 1.1.0, Emboss creates documents in Arabic, Hebrew and Persian that read right to left, and in Chinese, Japanese and Korean. You don't need a...

RTL and CJK documents#

From version 1.1.0, Emboss creates documents in Arabic, Hebrew and Persian that read right to left, and in Chinese, Japanese and Korean. You don’t need a second plugin or a different PDF engine.

Right-to-left documents#

Arabic and Hebrew are fully shaped in all four templates. Emboss joins Arabic letters into their correct shapes, puts each line in right-to-left order, and mirrors the layout: your logo and address blocks swap sides, the items table runs right to left, and the totals line up on the left.

An Arabic or Hebrew name inside a left-to-right document prints correctly too, so an English invoice for a customer with an Arabic name still reads right.

These languages use the DejaVu Sans font that ships with Emboss, so there’s nothing to install. Persian prints fully. Urdu is partial: see Limits.

Text direction#

Go to WooCommerce > Settings > Invoices > General > Text direction.

  • Automatic (default): right to left for Arabic, Hebrew, Persian and Urdu. Emboss goes by the site language, or by the order language when Language is set to Use the order language (WPML/Polylang).
  • Left to right: always.
  • Right to left: always. Useful for a store that sells only in Arabic or Hebrew but runs its admin in English.

A multilingual store with WPML or Polylang gets English invoices for English orders and Arabic invoices for Arabic orders, each in its own direction.

Chinese, Japanese and Korean#

Chinese, Japanese and Korean print once CJK fonts are added. These fonts are large, so Emboss doesn’t bundle them, and stores that never sell in these languages don’t carry the weight. Until you add one, CJK text prints as empty boxes.

The CJK fonts setting is under WooCommerce > Settings > Invoices > Advanced. It has three buttons.

Download CJK fonts#

Click Download CJK fonts and Emboss fetches three free, open-licensed (SIL OFL) font files, about 16 MB in total, from the Google Fonts repository on GitHub:

  • Chocolate Classical Sans for Chinese and Japanese.
  • Nanum Gothic regular and bold for Korean.

Nothing is downloaded until you click the button. The files come from one pinned commit of the repository, and Emboss checks each one by size and SHA-256 before it installs it. This is one of two features in Emboss that contact an outside service. The other is the optional QR code on packing slips.

Upload font#

Click Upload font to use your own TrueType font (.ttf) instead. An uploaded font is used before the downloaded ones.

The file has to be a single TrueType font smaller than 50 MB. Emboss refuses OpenType CFF fonts (.otf) and font collections (.ttc), because the PDF engine can’t embed them.

Remove CJK fonts#

Remove CJK fonts deletes the installed CJK fonts, downloaded and uploaded. Chinese, Japanese and Korean text then prints as empty boxes again.

Limits#

  • Urdu prints in the Naskh style, but only in part. DejaVu Sans has no glyph for heh goal (ہ, U+06C1) or yeh barree (ے, U+06D2), so those two letters print as boxes. The Nastaliq style isn’t available.
  • CJK line breaks can land before punctuation such as 。, so a line may start with a full stop.
  • Bold in Chinese and Japanese isn’t true bold, because the downloaded font has no bold weight. Korean has one.

Why Emboss needs PHP 8.3#

The text shaping library for Arabic and Hebrew needs a current PHP version, and PHP 8.3 is the version WooCommerce recommends. Emboss 1.1.0 requires PHP 8.3 or later. On older PHP, it shows a notice in the admin and doesn’t load. Most hosts let you change the PHP version from their control panel.

Troubleshooting#

What you seeTry this
Arabic letters stand apart instead of joiningCheck you’re on Emboss 1.1.0 or newer and PHP 8.3 or newer
Empty boxes instead of Chinese, Japanese or Korean charactersClick Download CJK fonts or Upload font under Invoices > Advanced
Two Urdu letters show as boxesHeh goal and yeh barree aren’t in the bundled font. See Limits.
The font upload is refusedUse a single TrueType .ttf file under 50 MB, not .otf or .ttc
Layout reads left to right on an Arabic orderSet Language to the order language, or set Text direction to Right to left
Your theme stylesheet override doesn’t mirrorCopy the 1.1.0 stylesheet again. Overrides made before 1.1.0 don’t have the RTL styles.

For developers#

The epdi_document_direction filter changes the direction for one order. Return rtl or ltr.

add_filter( 'epdi_document_direction', function ( $direction, $order ) {
    return 'AE' === $order->get_billing_country() ? 'rtl' : $direction;
}, 10, 2 );

Right-to-left documents get dir="rtl" on the HTML and the epdi-rtl body class, so template overrides can add their own RTL styles.