• 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

Warning: sqlite_query() expects parameter 1 to be resource, string given

How to change product Image when variables are selected in Shop and Archive Pages?

Multiple order by in WooCommerce

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Yii2 select2 database exception number of bound variables does not match number of tokens

Get keys from associative array [duplicate]

How to install LDAP in Docker php-fpm alpine

How to convert the int value to inch in PHP [closed]

merge all files in directory to one text file

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

Insert And Retrieve Data in MySQL with $.post Noob Question

Valet, Xdebug after reboot Big Sur not working

XSS attack still works despite htmlspecialchars() doing its work

Convert PHP array into HTML tag attributes separated by spaces

Open a popup box after receiving result from ajax

About Contact Privacy policy Terms and conditions