• 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

Combining a describing and one array with data

How to upload mpdf file after generating to s3 bucket in php

Laravel Route issues with Route order in web.php

How to unlink image from folder?

how to remove white space in select 2

Laravel Jetsream Profile page not loading on fresh install

Reorder attribute dropdown terms in Woocommerce single variable products

Using spatie/media-library, how to rename a collection of uploaded files?

Alert message after submitting form in PHP

Display the default discounted price and percentage on Woocommerce products

How to give apache permission to write to home directory?

How to fix this error : Ask your hosting provider to use PHP 7.2.5 or higher for both HTTP and CLI?

WHERE IN array binding in DB::raw laravel 5.4

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

Select option menu read from database and use it's values

About Contact Privacy policy Terms and conditions