• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

phppdf-generationmpdf


PHP Snippet 1:

ob_start();

PHP Snippet 2:

ob_end_flush();

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML($html);
$mpdf->Output();

Related Snippets

Make Shipping Method fields Mandatory on Woocommerce checkout page

How do I pass the dynamic output of a php variable or php function to a CSS variable?

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

PHP: Print caught exception like Xdebug

Return multiple values from a function using mysqli_fetch_assoc [closed]

How do I enable error reporting in Laravel?

Trying to iterate over a mongodb cursor twice - failing

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

Why does using salted hash on python and php give me different results?

Split a string array into pieces

How to fix Call to undefined method AppModelsTableName::factory?

php mysql + create a friend request system

Don't show recurring price for WooCommerce subscriptions worth 0$

Laravel-fopen: failed to open stream: Permission denied

How to create custom authentication in laravel 8?

About Contact Privacy policy Terms and conditions