• 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

Adding the custom page with add_menu_page function on Wordpress

Remove product downloads section in woocommerce email notifications

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

PHP-Sort array based on another array?

How to disable widget block editor of WordPress?

Error converting docx to pdf using Unoconv

How to make a foreign key not using primary key

Input and output values for php into the browser?

PHP returning an error message and false

Results page in other window

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

Log a user out of a website when they put their computer to sleep

Populate Dynamic Dropdowns List in Codeigniter

Using PHP to connect to a remote MSSQL database

Symfony 4: "Autowire: you should configure its value explicitly."

About Contact Privacy policy Terms and conditions