• 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

Laravel Pagination links() not working

How to insert data from multiple select dropdown values into database?

Printing more than one array using print_r or any other function in php

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'column_name' in Laravel

Using array_intersect on a multi-dimensional array

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

(PHPUnit) PHP Fatal error: Uncaught Error: Call to undefined function each()

Whats the point of running Laravel with the command 'php artisan serve'?

Access relation of pivot table in Laravel

woocommerce get_order_report_data to show order_item_id

PHPExcel export HTML table to xlsx

advanced custom fields wordpress custom class

How can I access an array/object?

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Attempted to call an undefined method named "get" of class "MailController"

About Contact Privacy policy Terms and conditions