• 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

java URL working on browser but not in client program

wordpress : How to specify the cause "This site can’t be reached"

How to properly start Laravel 8 with Bootstrap & authentication

PHPExcel_IOFactory::createWriter causes wrong behaviour

PHP if in_array() how to get the key as well?

Load a .env file with PHP

array_map triple dimensional array [duplicate]

Add rows to Single product Additional information table in WooCommerce 3.6

Transpose and flatten multiple rows of array data [duplicate]

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

Alert message after submitting form in PHP

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

Get image type from base64 encoded src string

Laravel 8 Multiple Relationships for Factory

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

About Contact Privacy policy Terms and conditions