• 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

How can I stop a symfony process which is listening on http://127.0.0.1:8000

Laravel passport auth token not working after moving to different server

Assign output of PHP function to a variable

Handle error for duplicate entries - PHP/MySQL

How to upload mpdf file after generating to s3 bucket in php

Laravel display validation error

How to KeyBy where multiple items have the same key

send email using gmail-api and google-api-php-client

Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

Laravel get user data with profile

Combine array with same value and add other [duplicate]

Download & Save Zoom Recording in directory by PHP

How to Make Laravel Eloquent "IN" Query?

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

How to get total pages of PDF with FPDF?

About Contact Privacy policy Terms and conditions