• 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

Convert date and time to Jalali in Laravel

Laravel 5.1 Unknown database type enum requested

How to get Laravel's CSRF Token from Another Website?

Find out the name of the last script that included the current one

ldap is missing from system when installing adldap2 in laravel

Select option from dropdown menu with PHP and mySql

Update Total in checkout of Woocommerce with Ajax Request

Make certain characters of a word from string bold

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

Problems getting instance of UploadedFile in Yii2

how to use extended ASCII instead of unicode in PHP

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

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

Smarty: undefined extension class 'Smarty_Internal_Method_Get_Template_Vars'

WAMP Virtual Host not working

About Contact Privacy policy Terms and conditions