• 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

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

Creating Combinations of Elements

oauth-private.key does not exist or is not readable

PHP: Print caught exception like Xdebug

Form Validation and Submission to database

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Get keys from associative array [duplicate]

google content api for shopping

Store / Website Column in Magento 2 Admin Grid - Custom Module

Lexik JWT authentication problem "Invalid credentials"

Sentry + Laravel: how to log an already catched Exception?

PHPExcel file download using AJAX call

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Implode array with array of glue strings

About Contact Privacy policy Terms and conditions