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 ?

link|improve this question
feedback

1 Answer

Have you tried putting your code in earlier during the load process? admin_init or earlier?

link|improve this answer
No, how I can do that ? I'm outputting the code at top of custom admin page. – Muhammad Adnan Nov 29 '11 at 18:58
put it in a function then attach that function to a hook – Tom J Nowell Nov 29 '11 at 21:29
in this hook admin_init ? – Muhammad Adnan Nov 30 '11 at 6:08
I tried this <br /> ** function generate_pdf_test_with_admin(){ echo 'test'; } add_action( 'admin_init', 'generate_pdf_test_with_admin' );** <br /> but it doesn't echo anything on page – Muhammad Adnan Nov 30 '11 at 6:51
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.