• 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

Use Python plotly chart in PHP

correct PHP headers for pdf file download

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

Having issue with matching rows in the database using PDO

PHP: Telegram Bot: Insert line break to text message

Insert a DIV after the 6th product only once in WooCommerce category archives

Message: Set sys_temp_dir in your php.ini after installed composer

Show only featured products in Woocommerce shop page

laravel 5.6 bulk inserting json data

PHP block shortcut in Visual Studio Code

Normalize DateInterval in PHP

Adding one microsecond to Datetime object in PHP

Unable to guess the mime type as no guessers are available Laravel 5.2

Change the alert text on add to cart action without selected variation in Woocommerce

Add and update products to session cart in Laravel

About Contact Privacy policy Terms and conditions