• 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

Problems getting instance of UploadedFile in Yii2

CodeIgniter force_download is not working

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

How to get transaction details in notify_url page in paypal

Parsing JSON File to array in PHP

Parameter is not sent to Laravel route in Ajax

Xdebug 3 not showing in phpinfo on m1 Monterey

I want to use codeigniter foreign character library in my custom PHP project how i can use it?

PHP using str_starts_with for array to exclude same as with wildcard

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

Manage independently the decimal number of the price of each product [duplicate]

Laravel Carbon throws error The format separator does not match

WordPress Security Standards want me to escape my html, but how to do it correctly?

How to modify CSS in a specific page of the WP admin dashboard (backend)

About Contact Privacy policy Terms and conditions