This one has consumed my entire weekend, and still we can't make mailing labels. Running Civi 4.7.15 on WordPress 4.7.2 ... successfully installed and tested wkhtmltopdf only to discover Civi doesn't use this app for mailing labels. Paths in TCPDF config appear to be good, and I haven't modified the code except for the config file (which I did after discovering the malfunction). Debugging shows no errors, yet every attempt to make mailing labels displays "TCPDF ERROR: Some data has already been output, can't send PDF file."

What might cause this?

  • There are two similar error messages in TCPDF: Some data has already been output, can't send PDF file ... and ... Some data has already been output to browser, can't send PDF file (First one, "output," second one, "output to browser.") In tcpdf.php there are three incidences of "Some data has already been OUTPUT" -- all of which are within if (ob_get_contents()) { $this->Error('Some data has already been output, can\'t send PDF file');
    – Prónay
    Commented Jan 30, 2017 at 14:15
  • The error I'm getting is "already been output". The "already been output to browser" message appears within if (headers_sent()) { $this->Error('Some data has already been output to browser, can\'t send PDF file'); ... suggesting a problem with headers having been sent from the output buffer. This isn't the error message I'm getting! I guess this means TCPDF looks in the output buffer, sees there is something there, consequently displays the "already been output" message, and then breaks before anything can be downloaded. Is that about right?
    – Prónay
    Commented Jan 30, 2017 at 14:16

1 Answer 1


I imagine the ideal solution would be to sniff out the reason there's content in the output buffer when there shouldn't be. That's not what I did. Knowing very little about PHP, I looked up functions pertaining to the output buffer, then added


right after the author/version comments in tcpdf.php ... that's the only change I had to make. Successfully downloaded my address label pdf in Civi and patted myself on the back.

  • Pronay - thanks for this. Got me out of a difficult situation. but two years later I'm on CiviCRM 5.11.0, WordPress same problem. But I had no problem on various versions of 4.7. But have you found a proper fix?
    – Mick Kahn
    Commented Apr 29, 2019 at 23:17
  • Thanks for the heads-up Mick! I'm currently stuck on another problem with a Civi extension, but I'll ask the other site admins to test our label printing to find out if it still works. Better to know ASAP than find out a few hours before the mailer has to go to the Post Office. Once I know how our TCPDF is faring, I'll report back here.
    – Prónay
    Commented Apr 30, 2019 at 13:51
  • OK, fixed the other issue and just now checked our Mailing Labels. Our TCPDF appears to be working fine today. We're running Civi 5.12.4 on WordPress 5.1.1 with PHP 7.1.22 -- so I can't speak to any related problems with Civi 5.11.0. If you haven't already, deactivate all CMS plugins (except Civi) to rule out a plugin conflict. If you still can't get it working and no one else has reported this problem, post a new SE question to get useful feedback from the developers. Good luck!
    – Prónay
    Commented Apr 30, 2019 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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