0

I am trying to generate a pdf in my wordpress plugin and for this I am using FPDF library. I am getting the following error Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file

Here I am trying to output the pdf using a wordpress shortcode mechanism in a page. I also tried all the possible soluions in this link but nothing worked for me. Anyone faced this issue in wordpress before?

Community
  • 1
  • 1
krishna89
  • 850
  • 1
  • 19
  • 42
  • Sounds like you've sent data before FPDF has had a chance to send headers. Do you use source control? Can you compare changes since adding FPDF and look for any leading whitespace before ` – Will Jul 20 '16 at 04:35
  • you could be correct because my wordpress header loads before fpdf code. But I am not sure how to ignore header for one page in wordpress – krishna89 Jul 20 '16 at 04:38
  • 1
    I'm not sure how much you're relying on WP loading for the data you're putting in the PDF, but the cleanest approach would be to create a stand alone file that does the FPDF work without running any of WP. – Will Jul 20 '16 at 04:59
  • Now I have created a separate file and fpdf is loading perfectly, but I have to bring some wordpress user data into this individual file, any idea how to do that? – krishna89 Jul 20 '16 at 06:17

0 Answers0