What is the issue with using the $pdf->Output() function in PHP when generating a PDF with TCPDF?

The issue with using the $pdf->Output() function in TCPDF is that it sends the PDF file directly to the browser, making it difficult to perform further actions on the PDF file before outputting it. To solve this issue, you can use the ob_start() and ob_get_clean() functions to capture the PDF output and then manipulate it as needed before sending it to the browser.

ob_start();
$pdf->Output('example.pdf', 'I');
$pdfData = ob_get_clean();

// Now you can manipulate $pdfData as needed before sending it to the browser
header('Content-Type: application/pdf');
echo $pdfData;