• 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

Using spatie/media-library, how to rename a collection of uploaded files?

Show date difference as "20" instead of "20 years ago"

Laravel Collections. Is there some kind of assertStructure method?

Laravel views are showing from cache on one server but works fine on other server

woocommerce get_order_report_data to show order_item_id

Facebook PHP SDK - will not logout properly

Insert multidimensional array to codeigniter cart

XSS attack still works despite htmlspecialchars() doing its work

Toggle between a textbox and a select using PHP

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

selected value from the listbox in php

Explain how this array transposing and flattening function works

Edit XML in HTML form and submit to self

Last order would be re-order in wooCommerce. How is it possible?

Nginx RTMP not recording

About Contact Privacy policy Terms and conditions