• Hello!

    I have customed the PDF creation, see for instance How to output a footnotes list by PHP?, so I have hesitated to update WP-MPDF in order to not to break my system.

    Some time ago I discovered that my site suffers from the Error Message: Failed to load PDF document issue. User got this message but by pressing the reload button on the error message dialog, the PDF got loaded ok. Because the PDF creation worked, there was just a fuss with a misleading error message dialog, I did not put any effort to solve this, especially because if the PDF was cached there was no error.

    I updated the WordPress to 5.8.2 a couple of days ago and I decided to take a look to this creation error. This time clicking on the reload button did not help, but reloading the page gave me the PDF!! I turned debug logging on in WordPress and reproduced the error dialog.

    In wp-config.php

    
    define( 'WP_DEBUG', true );
    	define( 'WP_DEBUG_LOG', true );
    	define( 'WP_DEBUG_DISPLAY', false );
    @ini_set( 'display_errors', 0 );
    

    No errors were caught. However, the topic Automatically create pdf? gave me the idea. I disabled the debug logging again in order to not slow down my site but retained the setting to not to show errors to the users and actived the cron job to create the PDFs in the background in advance. Given the frequency of new articles creating one new PDF every hour is more than enough for my site.

    Hope this helps anybody with the same issue.

    • This topic was modified 3 years, 4 months ago by Juha Mets?kallas. Reason: wrong markup
Viewing 1 replies (of 1 total)
  • Plugin Author fkrauthan

    (@fkrauthan)

    Thank you for sharing your trick. Usually the PDF error only happens in case of some PHP warnings that are getting returned to the browser which prevents the actual PDF download. Usually checking your PHP logs can reveal that.

    But glad you found a workaround.

Viewing 1 replies (of 1 total)
  • The topic ‘Error Message: Failed to load PDF document (take 2)’ is closed to new replies.