I see empty boxes ([][][]) instead of symbols in PDF
Seeing small empty boxes – often displayed as [][][] or □□□ – replacing letters, logos, or characters in an exported PDF is a common but fixable issue. This Advanced Order Export Troubleshooting guide explains exactly why it happens and provides several solutions for restoring proper text rendering in the Advanced Order Export for WooCommerce plugin.
This problem almost always occurs when exporting orders containing non‑Latin scripts such as Chinese, Japanese, Korean (CJK), Arabic, Hebrew, Cyrillic (Russian, Ukrainian, Bulgarian, etc.), Greek, or other special Unicode characters (e.g., Č, š, ü, ñ). The root cause is not a bug in the plugin, but a limitation of the underlying PDF generation library it uses.
Who Is Most Likely to Experience This Issue?
The problem appears when your order data contains any of the following:
- Chinese, Japanese, or Korean characters (customer names, product titles, shipping addresses)
- Arabic or Hebrew scripts (especially when the store serves Middle Eastern markets)
- Cyrillic characters (for stores based in Russia, Ukraine, Bulgaria, Serbia, etc.)
- Greek, Thai, Hindi, or other Unicode‑intensive scripts
- Special symbols such as € (euro), £ (pound), ©, ®, ±, ≥, ≤, or emoji
- Accented Latin letters (é, ü, ñ, ç, etc.) – while often supported by DejaVu Sans, they can sometimes fail depending on the specific character
If your orders are predominantly in English using standard ASCII characters, you are unlikely to encounter this issue.
Prerequisite: Verify That the Data Is Present in the Source
Before following the solutions below, please confirm that the “missing” characters actually exist in your original order data.
- In your WordPress admin, go to WooCommerce → Orders.
- Open the order that contains the problematic characters.
- Check the customer name, product title, shipping address, and order notes for the characters that appear as empty boxes in the PDF.
If the characters are not present in the order itself, the plugin cannot export them. In that case, the character‑encoding issue is likely occurring earlier in your data entry or storage process and may require a different troubleshooting path.
How to Fix Empty Boxes in PDF Exports
There are two primary ways to resolve this issue. Both are fully compatible with the free version of the plugin.
Option 1: Install a Full‑Unicode Font (The Original Free Method)
This is the method described in the original plugin documentation. It adds a custom Unicode‑aware font that covers almost all scripts used in the world, including CJK, Arabic, Cyrillic, and Hebrew.
What you need:
- FTP/SFTP access to your WordPress site (or a file manager provided by your hosting control panel).
- The Code2003 font file (or any other .ttf font with extensive Unicode coverage; see the section below on alternative fonts).
Step‑by‑step instructions:
1: Download a full‑Unicode font file from https://freefontsdownload.net/free-st-gigafont-typefacescode2003-font-152444.htm. Code200365k.ttf, a large bitmap font that covers tens of thousands of characters.
2: Connect to your WordPress site using an FTP client or navigate to your hosting control panel’s file manager.
3: Navigate to your active theme’s directory: /wp-content/themes/your-active-theme/.
4: Create a new folder named fonts inside your active theme directory.
5: Upload the downloaded .ttf font file into the fonts folder you just created.
6: Add the following PHP code to your theme’s functions.php file. You can add it at the end of the file, just before the closing ?> tag (if present):
|
1 2 3 4 5 6 7 8 |
add_filter("woe_formatter_pdf_use_external_font","__return_true"); add_filter("woe_formatter_pdf_apply_external_font",function($fpdf){ $fpdf->setFontPath( dirname( __FILE__ ) ."/fonts/"); $fpdf->AddFont( 'Code200365k', "", "Code200365k.ttf" ); $fpdf->AddFont( 'Code200365k', "B", "Code200365k.ttf" ); $fpdf->SetFont( 'Code200365k', '', 12 ); return $fpdf; }); |
Important notes:
- Replace
Code200365k.ttfwith the actual name of the.ttffile you uploaded. - The font file name is case‑sensitive.
- This method affects all PDF exports generated by the plugin, not just a single profile.
Since the Code200365k.ttf file is a large bitmap font, it may not produce the most polished output for certain scripts. For better results with specific languages, consider using alternative fonts (see “Which Font Should I Use?” below).
Option 2: Switch the PDF Library to mPDF (Alternative Approach)
If the custom font method does not work for you – or if you prefer a more automated solution – you can replace the underlying PDF engine. mPDF is an alternative PHP library that provides much better Unicode support without requiring manual font installation.
However, please note:
- This method does not automatically work with the Advanced Order Export for WooCommerce plugin out of the box. Many WordPress PDF plugins (e.g., WooCommerce PDF Invoices) offer a built‑in option to switch from dompdf to mPDF. The Advanced Order Export for WooCommerce plugin does not currently have that setting.
- Attempting to replace the library requires custom code and a good understanding of WordPress development. Unless you are a developer, the first method (installing a Unicode font) is strongly recommended for its simplicity.
If you are comfortable with coding, you can research using Composer to install mPDF and then overriding the plugin’s default woe_formatter_pdf_use_external_font filter to point your export to mPDF instead of dompdf.
Which Font Should I Use?
The original documentation uses Code200365k.ttf because it is a large bitmap font that attempts to cover every Unicode character. It is adequate but not always aesthetically optimal for modern documents.
For better results with the first method, consider using one of these fonts instead:
| Font Name | Best For | Where to Find |
|---|---|---|
| DejaVu Sans | Cyrillic, Greek, Latin, Hebrew (partial) | Open source, widely available |
| Noto Sans (by Google) | Almost every script: CJK, Arabic, Hebrew, Devanagari, etc. | Google Noto Fonts |
| Arial Unicode MS | Comprehensive Unicode coverage | Commercial; often included with Microsoft Office |
| FreeSerif / FreeSans | Latin, Cyrillic, Greek, Armenian, Georgian | GNU FreeFont project |
To use a different font:
- Download the
.ttffile for your chosen font. - Upload it to the
fontsfolder as described above. - Replace every occurrence of
Code200365kin the PHP code with the name of your font file (without the.ttfextension).
Advanced Order Export Troubleshooting Checklist for PDF Issues
If you have tried the steps above and are still seeing empty boxes, run through this checklist:
- Confirm the font is properly loaded. Add a temporary line inside your theme’s
functions.php, such aserror_log(‘Font path: ’ . dirname( FILE ) . ’/fonts/’);. Then run an export and check your server’s error log to see if the path is correct. - Check file permissions. The
fontsfolder should have 755 or 775permissions. The.ttffile itself should have 644 or 664 permissions. - Verify the font file is not corrupt. Try uploading a different
.ttffile (e.g., DejaVu Sans) and update the PHP code accordingly. - Test with a minimal export. Create a new export profile that includes only one order with the problematic characters. Export it to PDF. This helps isolate whether the issue is specific to a particular profile or global.
- Check for PHP memory exhaustion. If you are exporting a very large number of fonts or orders, the PDF generation process may time out. Increase
memory_limitto256Mor higher and increasemax_execution_timeto300seconds in yourphp.iniorwp-config.php. - Inspect the font path for errors. The code above uses
dirname( FILE ) .“/fonts/”, which points to your active theme’s folder. If your theme is a child theme, thefontsdirectory must be inside the child theme folder, not the parent theme. - Ensure the PHP code has no syntax errors. After adding the code to
functions.php, visit any page on your site. If you see a white screen or a PHP error message, revert the change immediately and check your code formatting. - Clear your server cache. If your site uses a caching plugin (e.g., WP Rocket, W3 Total Cache) or a server‑side cache (e.g., Redis, Varnish), purge the cache and run the export again.
If you have completed all the steps in this Advanced Order Export Troubleshooting guide and the issue persists, continue to the next section for support.
How to Prevent This Problem in Future Exports
Once you have resolved the empty‑box issue using either the custom font method or (if applicable) an mPDF switch, here are a few best practices to keep your PDF exports clean:
- Keep a backup of your
functions.phpcode and thefontsfolder. If you update your theme, thefunctions.phpfile may be overwritten, causing the font configuration to disappear. Store a copy of the code snippet in a secure location. - Use a child theme. If you add the custom font code directly to a parent theme, a theme update will wipe out your changes. Always use a child theme for any custom code.
- Test after every plugin update. When you update the Advanced Order Export for WooCommerce plugin, run a test PDF export to ensure your font customisation remains intact.
- Monitor your server’s error log. If new characters start appearing as empty boxes, check the error log for messages like “Font not found” or “cannot open .ttf file”.