• 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

Stop caching for PHP 5.5.3 in MAMP

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

How to keep value of selected value after form submission?

SQL to convert multiple rows into a single row of variable length

Laravel UUID generation

php curl requesting twice

Add New Parameter to Existing URL using htaccess

Display specific shipping method if woocommerce product has specific acf field value

Xdebug can't connect back to Docker host

Xdebug in Laravel is not working with VSCode

laravel 5.6 bulk inserting json data

generate an Excel file using PHP

PHP: set a (deep) array key from an array [closed]

How to properly start Laravel 8 with Bootstrap & authentication

Laravel websockets AWS EC2 - Connection failed

About Contact Privacy policy Terms and conditions