Answers.Body: <p>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 </p>
  
  <pre><code>ob_clean();
  </code></pre>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-29T23:17:17.587Z
Answers.Text: 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?
Answers.UserDisplayName: Mick Kahn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-30T13:51:27.320Z
Answers.Text: 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.
Answers.UserDisplayName: Prónay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-30T15:38:51.520Z
Answers.Text: 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!
Answers.UserDisplayName: Prónay
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-30T15:07:46.847Z
Answers.LastActivityDate: 2017-01-30T15:07:46.847Z
Answers.UserDisplayName: Prónay
Body: <p>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."</p>
  
  <p>What might cause this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-30T14:15:58.450Z
Comments.Text: 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');`
Comments.UserDisplayName: Prónay
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-30T14:16:34.490Z
Comments.Text: 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?
Comments.UserDisplayName: Prónay
Tags: <mailing><pdf><address-labels>
Title: Mailing labels - print: "TCPDF ERROR: Some data has already been output, can't send PDF file"
ThreadText: # Mailing labels - print: "TCPDF ERROR: Some data has already been output, can't send PDF file"
  
  (Asked by: username_0 on 2017-01-30)
  
  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?
  
  **Tags:** mailing, pdf, address-labels
  
  > **Comments:**
  > **username_0**: 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');`  
  > **username_0**: 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?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-01-30. Score: 3 | Accepted answer
  
  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 
  ob_clean();
  
  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.
  
  > **Comments:**
  > **username_1**: 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?  
  > **username_0**: 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.  
  > **username_0**: 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!  
  
  ---
  
  