• 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: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

PHP DOTENV unable to load env vars

How to skip cart page on woocomerce for certain products only?

Error converting docx to pdf using Unoconv

laravel controller function parameters

php curl requesting twice

Transfer data between JavaScript and PHP through JSON

Laravel Carbon throws error The format separator does not match

Laravel-fopen: failed to open stream: Permission denied

If action is on a different page do I use fwrite function

best way to store error messages in Laravel (session or variable)

PHP contact form configuration [duplicate]

Laravel views are showing from cache on one server but works fine on other server

How can i call a function that executes an fpdf based on the choice of a form selector?

Spam Filter in Contact Form

About Contact Privacy policy Terms and conditions