• 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

Where do I need to place a hook for phpunit?

How in Laravel run JavaScript code stored in php variable?

How to redirect to another page and call a Function there on Angular ng-click

Custom API and cunsuming in php?

Edit XML in HTML form and submit to self

Correct way to use LIKE '%{$var}%' with prepared statements?

Laravel Livewire: jQuery not working in child component loaded via @if statement

Distribute array row data to make multiple new rows

Transfer data between JavaScript and PHP through JSON

How to submit a form when page loads using JavaScript?

Add New Parameter to Existing URL using htaccess

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

Target Individual Form Instance/Counter Inside A PHP While Loop

Laravel Passport - Not able to get token string in response?

Increase value by 1 on button click

About Contact Privacy policy Terms and conditions