• 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

protect my blog content

WooCommerce Additional Information - if empty, hide

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

How to convert binary string to normal string in php

How to convert a carbon into string, to take the date only?

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Laravel Jetsream Profile page not loading on fresh install

Custom add to cart button URL for specific product in WooCommerce?

Laravel Multi-language routes without prefix

PHP, how to convert Int value to Week days

Google API Heatmap Layer exception, why?

Xdebug can't connect back to Docker host

Laravel Command Schedule Not Working Properly

best way to store error messages in Laravel (session or variable)

Laravel get user data with profile

About Contact Privacy policy Terms and conditions