TCPDF ERROR: Some data has already been output, can’t send PDF file

Add the function ob_end_clean(); before call the Output function.
It worked for me within a custom WordPress function!

ob_end_clean();
$pdf->Output($pdf_name, 'I');

Leave a Comment