I’m generating PDF using tcpdf library in WordPress admin side. but getting the following error.
TCPDF ERROR: Some data has already been output to browser, can’t send PDF file
It has header_sent() is true means it has set its headers already and not modifying the pdf headers by tcpdf. any ideas ?
I would recommend doing this:
On the page where you are currently trying to output the PDF to the browser, save the PDF to a file on your server instead. Then, add a link to the file on your admin page.
This way the download of the PDF is a separate browser GET request and there will be no problem with headers.
If you are trying to output HTML and a PDF on the same admin page then it will never work, no matter how early in the page-render you put the PDF output.