• 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

Reducing authentication calls on external API (Laravel 5.6)

Adding Multiple Custom Post Types in Wordpress

php curl requesting twice

Cache clear probem in Larave

How can I format this number correctly using PHP?

Add customer email and phone in "Order" column to admin orders list on Woocommerce

How can I make Laravel return a custom error for a JSON REST API

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

SlimExceptionHttpNotFoundException

Get all WooCommerce products within own plugin

Auto increment id JSON

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

sort() not affecting original array while inside foreach loop

Pages are working fine on localhost but not running on the hosting server

Laravel after login Two factor not working

About Contact Privacy policy Terms and conditions