• 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

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

The "client_reference_id" argument is not passed

Adding reCAPTCHA v2 into my PHP file

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

PHP only Hit Counter?

Composer fails with kylekatarnls/update-helper on new homestead

php code to send checkbox form results to email

file_put_content...fail to open stream:Permission denied in Laravel 5

How to KeyBy where multiple items have the same key

Substitute integers and dots with regex [duplicate]

Laravel Schedule not sending email

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

Lumen - Postgresql setup - Composer

PHP - installing Xdebug on Mac with XAMPP (Unix File)

About Contact Privacy policy Terms and conditions