Jump to content
  • 0

Tcpdf Error: Can't Send/view Invoices


Joseph H

Question

14 answers to this question

Recommended Posts

  • 0

SOLVED

 

Issue was blank lines at the top of config/blesta.php. Grrr! I wrote the above post right before getting in my car to drive home. Thinking about it on the way home,  I realised that this had to be the issue. 

 

I use Salt Stack to manage my servers, and it was placing these blank lines when it parsed the file template.

 

Such a waste of time tracking that down!

 

-Barry

Link to comment
Share on other sites

  • 0

I have noticed and error while trying to view invoices. I get "TCPDF ERROR: Some data has already been output, can't send PDF file

 

Any Idea on how to solve this

 

Using blesta 3.3.1

 

Hi

 

Yes, I am having the same issue on some of my servers, but not others. I temporarily fixed it using the method outlined in http://www.blesta.com/forums/index.php?/topic/2141-tcpdf-error/

 

As a matter of interest, can you tell me - if you go into /admin/settings/company/billing/customization/ and upload a logo for the invoice - does the thumbnail show up correctly? I only see a broken image as in the screenshot attached. I somehow think these things are related because neither happens on one set of servers but both on the other.

post-578-0-87995800-1415268967_thumb.png

Link to comment
Share on other sites

  • 0

Hi

 

Yes, I am having the same issue on some of my servers, but not others. I temporarily fixed it using the method outlined in http://www.blesta.com/forums/index.php?/topic/2141-tcpdf-error/

 

As a matter of interest, can you tell me - if you go into /admin/settings/company/billing/customization/ and upload a logo for the invoice - does the thumbnail show up correctly? I only see a broken image as in the screenshot attached. I somehow think these things are related because neither happens on one set of servers but both on the other.

 

Same Issue on my end. The logo Is not showing too. Weird... :huh: ...

post-10485-0-14026500-1415282994_thumb.p

 

Thanks, adding ob_end_clean(); really fixed it. But the thumb nail is not showing yet... I hope Blesta can look into this deeper

Link to comment
Share on other sites

  • 0

Same Issue on my end. The logo Is not showing too. Weird... :huh: ...

attachicon.gifScreenshot_2.png

 

Thanks, adding ob_end_clean(); really fixed it. But the thumb nail is not showing yet... I hope Blesta can look into this deeper

 

 

Interesting. Sorry you are having the same issue, but also I am glad it is not just me!

 

Can you tell me the details of your platform?

 

I am running:

 

OS: Ubuntu 14.04

PHP: 5.5.9

Apache: 2.4.7

Blesta: 3.2.2

PHP5.5 Hotfix installed.

 

 

-Barry

Link to comment
Share on other sites

  • 0

Interesting. Sorry you are having the same issue, but also I am glad it is not just me!

 

Can you tell me the details of your platform?

 

I am running:

 

OS: Ubuntu 14.04

PHP: 5.5.9

Apache: 2.4.7

Blesta: 3.2.2

PHP5.5 Hotfix installed.

 

 

-Barry

 

Ubuntu 14

php 5.5

Apache 2.4.9

Blesta 3.3.1

Hotfix installed 

 

My hunch is on the hot fix

Link to comment
Share on other sites

  • 0

What is the path to the logo set to? View the source for that page and search for "inv_logo". It should be set to something like /path/to/blesta/uploads/invoices/inv_logo

What response does the browser give when it attempts to fetch the logo? You can check this in your browser with developer tools, or in the web server logs.

 

For the TCPDF error, can you remove the code changes you made to fix that issue, and instead try the following:

  1. Open /vendors/tcpdf/tcpdf.pdp
  2. At the bottom of the file there should be the characters: ?>
  3. Ensure "?>" are the last two characters of the file. If there is any white-space or new lines after those two characters, remove them.
  4. Save the file
  5. Try downloading an invoice from Blesta again
Link to comment
Share on other sites

  • 0

 

What is the path to the logo set to? View the source for that page and search for "inv_logo". It should be set to something like /path/to/blesta/uploads/invoices/inv_logo

What response does the browser give when it attempts to fetch the logo? You can check this in your browser with developer tools, or in the web server logs.

 

For the TCPDF error, can you remove the code changes you made to fix that issue, and instead try the following:

  1. Open /vendors/tcpdf/tcpdf.pdp
  2. At the bottom of the file there should be the characters: ?>
  3. Ensure "?>" are the last two characters of the file. If there is any white-space or new lines after those two characters, remove them.
  4. Save the file
  5. Try downloading an invoice from Blesta again

 

 

Hi Tyson,

 

Regarding inv_logo, the path, etc are correct. I have multiple servers running the same company - one on Ubuntu 12.04, which displays the logo thumb (and downloads invoices) fine, and the other Ubuntu 14.04 which does not.

 

Using wget, I have downloaded the inv_logo on both platforms. The issue on the 14.04 is that there are two blank lines prepended to the downloaded file. If I open this up in an editor and delete the two lines the image then opens correctly in an image editor.

 

I have also checked the HTTP headers from both servers for the same inv_logo and they are both identical. 

 

There is no server or other error reported when serviing this file. It is a 200 OK. The only issue being that these two lines are being prepended which corrupts the file.

 

I have also scp'd the image directly from the web server and confirmed that the image itself is fine. Only when it is served from the /uploads/invoices/inv_logo URL is it corrupted.

 

My suspicion is that both the tcpdf error and this image corruption are due to the same root cause. Tcpdf complains about data already sent, and in this image file there is clearly also data being sent prior to the file itself.

 

I have tried turning off any compression, (mod_deflate and gzip in apache) but it makes no difference.  

 

I have to say I am quite stumped at the moment. Apart from the tcpfd and inv_logo everything else works perfectly. My best guess is this is due to some buffering issue but I can't fine where.

 

-Barry

Link to comment
Share on other sites

  • 0

I agree it looks like an output buffering issue that is handled differently between those versions of Ubuntu. However, I don't see anything obvious in Blesta that might cause two lines to be output before the logo image.

 

Did you try my alternate suggestion to resolve the TCPDF error? Does that resolve the issue as well?

Link to comment
Share on other sites

  • 0

I agree it looks like an output buffering issue that is handled differently between those versions of Ubuntu. However, I don't see anything obvious in Blesta that might cause two lines to be output before the logo image.

 

Did you try my alternate suggestion to resolve the TCPDF error? Does that resolve the issue as well?

 

Yes. There is no additional space or other character after ?> in the file. 

Link to comment
Share on other sites

  • 0

I agree it looks like an output buffering issue that is handled differently between those versions of Ubuntu. However, I don't see anything obvious in Blesta that might cause two lines to be output before the logo image.

 

Did you try my alternate suggestion to resolve the TCPDF error? Does that resolve the issue as well?

 

I tried your suggestion, but It did not resolve the issue for me.

Link to comment
Share on other sites

  • 0

I have noticed that any file processed through blesta is getting two blank lines prepended to it. However if I create a normal php file on the same server but which is not processed by Blesta then I do not get the two blank lines.

 

Anybody have any idea where these might be getting added? Driving me nuts at this stage. 

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...