Fixing PDF generation errors

Deep-dive on PDF-specific errors โ€” memory, fonts, and known mPDF quirks.

2 min read Updated May 2, 2026 Beginner

DocuMerge uses mPDF to convert DOCX output to PDF. mPDF is reliable but has edge cases.

Error: “Allowed memory size exhausted”

PDF generation is memory-intensive, especially for documents with images or long tables.

Fix by raising PHP memory:

// In wp-config.php, before the line that says "That's all, stop editing!"
define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

If your host doesn’t allow this, ask support to raise memory_limit in php.ini to at least 256M.

Error: “Some data has already been output, can’t send PDF”

Caused by another plugin or theme producing output (whitespace, an error message) before the PDF is streamed. Solution: disable other plugins one by one to find the culprit.

Non-English characters render as empty boxes

mPDF ships with the DejaVu font family, which covers Latin, Cyrillic, and Greek scripts. For CJK languages (Chinese, Japanese, Korean), Arabic, Hebrew, Thai, or similar, you need an extended font pack. Pro includes broader font support; in Lite, restrict your templates to DejaVu-compatible characters.

PDF looks different from the DOCX

DOCX and PDF are different formats with different rendering engines. Some differences are expected:

  • Minor spacing and line-break differences
  • Text flowing differently around images
  • Custom Word fonts substituted if they’re not on the server

For pixel-perfect output, test the template in both formats before going live.

Very large PDFs (100+ pages)

Generation can take 30 seconds or more. The browser may time out. For long documents, consider breaking the template into sections or upgrading to Pro which supports background processing.

Did this answer your question?