Generate PDF using tcpdf from WordPress admin side custom page [closed]

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.