Joseph H Posted November 6, 2014 Report Posted November 6, 2014 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 Quote
0 barryf Posted November 10, 2014 Report Posted November 10, 2014 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 Michael 1 Quote
0 barryf Posted November 6, 2014 Report Posted November 6, 2014 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. Quote
0 Joseph H Posted November 6, 2014 Author Report Posted November 6, 2014 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... ... Thanks, adding ob_end_clean(); really fixed it. But the thumb nail is not showing yet... I hope Blesta can look into this deeper Quote
0 barryf Posted November 6, 2014 Report Posted November 6, 2014 Same Issue on my end. The logo Is not showing too. Weird... ... Screenshot_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 Quote
0 Joseph H Posted November 6, 2014 Author Report Posted November 6, 2014 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 Quote
0 Tyson Posted November 6, 2014 Report Posted November 6, 2014 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: Open /vendors/tcpdf/tcpdf.pdp At the bottom of the file there should be the characters: ?> Ensure "?>" are the last two characters of the file. If there is any white-space or new lines after those two characters, remove them. Save the file Try downloading an invoice from Blesta again Quote
0 barryf Posted November 6, 2014 Report Posted November 6, 2014 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: Open /vendors/tcpdf/tcpdf.pdp At the bottom of the file there should be the characters: ?> Ensure "?>" are the last two characters of the file. If there is any white-space or new lines after those two characters, remove them. Save the file 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 Quote
0 Tyson Posted November 6, 2014 Report Posted November 6, 2014 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? Quote
0 barryf Posted November 6, 2014 Report Posted November 6, 2014 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. Quote
0 Joseph H Posted November 6, 2014 Author Report Posted November 6, 2014 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. Quote
0 barryf Posted November 7, 2014 Report Posted November 7, 2014 I have now tried this on Debian 7 with Apache 2.2.22 and PHP 5.4.34 without any hotfix applied and I still get the same issue. So the only major difference between this and the working one is that the working one uses PHP 5.3. Quote
0 Michael Posted November 7, 2014 Report Posted November 7, 2014 I've not had any issues on PHP 5.4 on CentOS 6.5 So I would say it's a Debian issue. Quote
0 barryf Posted November 10, 2014 Report Posted November 10, 2014 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! Quote
0 Tyson Posted November 11, 2014 Report Posted November 11, 2014 Glad to hear you were able to figure it out. As a general solution, anyone encountering this issue should make sure that each *.php file does not start or end with white-space. Michael and Joseph H 2 Quote
Question
Joseph H
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
14 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.