• 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

Querying only one row from a one to many relationship laravel

Laravel after login Two factor not working

Confirm Leave on External Links in Wordpress

Get WooCommerce products from specific category

Pagekite error: FAIL: localhost:8080 is down

Boolean assignment operators in PHP

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

Check if string contains a value in array [duplicate]

Upgrade PHP on AWS Linux

Sentry on Symfony: how to exclude `NotFoundHttpException`

User pool client {id}does not exist

How to get values inside <![CDATA[values]] > using php DOM?

HTML + PHP + PHPMAILER

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Laravel Factory not calling callback 'afterCreating'

About Contact Privacy policy Terms and conditions