Title: Error with MPDF
Last modified: July 28, 2021

---

# Error with MPDF

 *  Resolved [arthpix](https://wordpress.org/support/users/arthpix/)
 * (@arthpix)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/)
 * The plugin was working great. But suddendly stopped working and now returns a
   blank page with error:
    `Fatal error: Uncaught Mpdf\MpdfException: Data has already
   been sent to output, unable to output PDF file in /home/vangartc/vangartdecoracion.
   com/wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Mpdf.php:9547 Stack trace:#
   0 /home/vangartc/vangartdecoracion.com/wp-content/plugins/wc-cart-pdf/wc-cart-
   pdf.php(176): Mpdf\Mpdf->Output('WC_Cart-2021072...', 'D') #1 /home/vangartc/
   vangartdecoracion.com/wp-includes/class-wp-hook.php(292): wc_cart_pdf_process_download('')#
   2 /home/vangartc/vangartdecoracion.com/wp-includes/class-wp-hook.php(316): WP_Hook-
   >apply_filters(NULL, Array) #3 /home/vangartc/vangartdecoracion.com/wp-includes/
   plugin.php(484): WP_Hook->do_action(Array) #4 /home/vangartc/vangartdecoracion.
   com/wp-includes/template-loader.php(13): do_action('template_redire...') #5 /
   home/vangartc/vangartdecoracion.com/wp-blog-header.php(19): require_once('/home/
   vangartc/...') #6 /home/vangartc/vangartdecoracion.com/index.php(17): require('/
   home/vangartc/...') #7 {main} thrown in /home/vangartc/vangartdecoracion.com/
   wp-content/plugins/wc-cart-pdf/vendor/mpdf/mpdf/src/Mpdf.php on line 9547`
 * Settings:
    - WordPress 5.7.2
    - Woocommerce 5.1.1
    - Woocommerce CartPDF 2.1.3
    - Send copy to admin enabled
    - Using a personalized template to add more data to the pdf
    - Also using a custom function to adds customer ID to filename for logged-in
      users
 * I tried disabling all plugins except for WC itself and WCPDF and also disabling
   my custom scripts and template, but the same happens. I searched the forum and
   saw a thread from a year ago with the same issue, but no info in there, nor a
   posibble solution.
 * I don’t now if this error came with the last update. but as far as I remember
   that was about a week ago.
 * Despite the error, this is really a great plugin!!
 * Hope someone can help, thanks.
    -  This topic was modified 4 years, 11 months ago by [arthpix](https://wordpress.org/support/users/arthpix/).
      Reason: Adding some more info
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-with-mpdf%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [David Jensen](https://wordpress.org/support/users/dkjensen/)
 * (@dkjensen)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/#post-14711953)
 * This is usually indicative of content being printed before the PDF can generate,
   typically a PHP notice or error. Do you have WP_DEBUG enabled on the site or 
   any notices/errors printing to the screen?
 *  Thread Starter [arthpix](https://wordpress.org/support/users/arthpix/)
 * (@arthpix)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/#post-14712277)
 * Thankyou, David.
 * Yes I enabled WP_DEBUG and the output was the one i posted in my first message.
   There aren’t other error notices in the site.
 *  Plugin Author [David Jensen](https://wordpress.org/support/users/dkjensen/)
 * (@dkjensen)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/#post-14712398)
 * Is the error happening still if you turn WP_DEBUG off and then turn on WP_DEBUG_LOG?
 *  Thread Starter [arthpix](https://wordpress.org/support/users/arthpix/)
 * (@arthpix)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/#post-14712928)
 * It was my (ridiculous) mistake…
 * Turned on WP_DEBUG_LOG and noticed a different warning about headers already 
   sent in my functions.php line 1.
    Don’t know how, but the first line on the file
   was blank (Before the php tag) and that affected MPDF, but apparently everything
   else was working fine. I just erased that line and the plugin got back to work
   as smooth as before.
 *     ```
       // This line was blank
       <?php
       // My code
       ?>
       ```
   
 * Thank you again, for your suggestion about WP_DEBUG-LOG and for this really wonderful
   plugin.
    -  This reply was modified 4 years, 11 months ago by [arthpix](https://wordpress.org/support/users/arthpix/).
      Reason: Adding information
    -  This reply was modified 4 years, 11 months ago by [arthpix](https://wordpress.org/support/users/arthpix/).
 *  Plugin Author [David Jensen](https://wordpress.org/support/users/dkjensen/)
 * (@dkjensen)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/#post-14714827)
 * Ok glad you were able to get it sorted 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error with MPDF’ is closed to new replies.

 * ![](https://ps.w.org/wc-cart-pdf/assets/icon-256x256.png?rev=3339735)
 * [Cart PDF for WooCommerce](https://wordpress.org/plugins/wc-cart-pdf/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wc-cart-pdf/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wc-cart-pdf/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-cart-pdf/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-cart-pdf/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-cart-pdf/reviews/)

## Tags

 * [mPDF](https://wordpress.org/support/topic-tag/mpdf/)
 * [pdf](https://wordpress.org/support/topic-tag/pdf/)

 * 5 replies
 * 2 participants
 * Last reply from: [David Jensen](https://wordpress.org/support/users/dkjensen/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/error-with-mpdf/#post-14714827)
 * Status: resolved