• 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

WordPress Subquery returns more than 1 row on SELECT

How to downgrade or install a specific version of Composer?

PHP Find Array Index value in multi-line array

Composer Script echo

Override default Auth routes in Laravel 7

Only on Firefox "Loading failed for the <script> with source"

Laravel database insert with combining array and string

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

WordPress - Dynamically add user ID to the end of a URL

WooCommerce - unset "<product> removed notice…" on cart page

Dynamic dropdown Ajax PHP request

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Undefined Array Key error when uploading image on php

How to run or debug php on Visual Studio Code (VSCode)

how can I set a session variable in Drupal 8 and get it in a php script?

About Contact Privacy policy Terms and conditions