ffeingol Posted July 11, 2009 Share Posted July 11, 2009 We've having a heck of a time with PDF invoices in V4.x. We're using a slightly modified version of Sparky's PDF invoice template (we just display a custom client column on the invoice). If an order comes in or you save an invoice to PDF it works great. When we run invoicing or may run credit cards we get blank PDF's. If you open up one of the 'blank' PDF's and look at the properties of the PDF it says that there are 80ish pages that are .4 in x .4 in. I've already tried tech support from both WHMCS and Sparky and so far no one has been able to come up with a solution so I figured asking the community just could not hurt. TIA for any thoughts or suggestions. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 11, 2009 Share Posted July 11, 2009 I was still waiting to hear back from you. As I had told you it is not the custom template at fault. There is nothing in the template that can cause small pages of .4in It has to be with tcpdf.php or the way that the batch (or loop) is done or outputed. More than likely the output is generated with the S command (S: return the document as a string. name is ignored.) so it could be generating too large of a string resulting in the error. PHP imposes no boundary on the size of a string; the only limit is the available memory of the computer on which PHP is running. I believe that it is restricted to 1024 bytes max per line though from what I have googled. This could be a possibility. A google search on "variable string length php hardening" and "tcpdf blank pages" returns some interesting reading. 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted July 11, 2009 Author Share Posted July 11, 2009 Sparky, Yes, I meant no offense to your product or support (it's been great). I just posted this to see if anyone else in the community is running into the same problem. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 12, 2009 Share Posted July 12, 2009 Sparky, Yes, I meant no offense to your product or support (it's been great). I just posted this to see if anyone else in the community is running into the same problem. None taken... I also would like to see this solved. I cannot replicate it but the evidence speaks for itself. 0 Quote Link to comment Share on other sites More sharing options...
oempire Posted July 28, 2009 Share Posted July 28, 2009 yep i too have a similar frustrating issue - ive had to go back to the original crappy looking template until i work out the cause 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted July 28, 2009 Author Share Posted July 28, 2009 Glad to hear at least someone else is having the same issue. We were beginning to believe we were alone in the world @oempire Were you using Sparky's template? How high did you have to set PHP memory? Thanks 0 Quote Link to comment Share on other sites More sharing options...
oempire Posted July 29, 2009 Share Posted July 29, 2009 i cranked mine up to 500 MB + for testing - which still didn't help. definitely not alone - theres a number of people on the forum with similar problems. Mine started out as a cron memory error - Sparky initially gave me some updated files etc - and it seemed to stop the memory issue. But then i found when multiple invoices were generated - the first one came out perfectly fine. all others came out as a little white square. Sparky mentioned the version whmcs uses for pdf is fairly out of date. so that could be the problem. But using the default invoice works fine - so im looking down the track that the template that sparky provides must use a function or technique thats causing the issues for me. now just to find what hes using thats causing the issue! 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted July 29, 2009 Author Share Posted July 29, 2009 This is great to hear. Misery loves company We currently have our memory set to 512MB and we can crank out about 180 invoices before it blows on memory. As you say the first couple of PDF's come out fine then the small blank square. I've done quit a bit of experimenting and have not narrowed down the issue. We had WHMCS support update TCPDF to the latest (at the time) version and that got us 'further' (up to the 180 ish level) of invoices but it's still not 'right'. We do 1st of the month billing and will be cranking out somewhere between 800 - 1,000 invoices per month so this is getting to be a huge issue. The biggest problem is that this is almost impossible to test w/o actually running invoices. With that scenario we really only have two testing opportunities per month (when invoices run and when credit cards run). It will take a very long time to debug at that rate. Thank you very much for sharing your info and please if anyone else is having this issue please chime in. WHMCS support though we were the only ones with this issue. 0 Quote Link to comment Share on other sites More sharing options...
oempire Posted July 29, 2009 Share Posted July 29, 2009 yep i hear you its a pain to try and debug - at least i have the luxury of billing every day so i only have to wait generally 24 hours to test ...lol now to try and find what function sparky uses that would be killing it. im going to just start chopping various elements out until i find the cause with his template. 0 Quote Link to comment Share on other sites More sharing options...
oempire Posted July 29, 2009 Share Posted July 29, 2009 as a note sparky i also upped the limits via php hardening config. for post and get variables - to LARGE figures. my logs are not catching any error either. I guess the script thinks its completed correctly. But it has to be something specific to the template as the normal default template works fine. 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted July 29, 2009 Author Share Posted July 29, 2009 @oempire, If it helps you debug we have commented out the SetCreator (just to eliminate that) and SetProtection (because the doc says that can be very CPU intensive). Neater of them really seemed to have any effect. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 29, 2009 Share Posted July 29, 2009 (edited) Hi Guys, Just a thought... do both of you happen to have $pageformat set to "LETTER"? if so try it with it set back to the default "A4" Could explain the .4" x .4" blank page EDIT: Also one other thing to try change 'PrintScaling' => 'AppDefault', to 'PrintScaling' => 'None', Edited July 29, 2009 by sparky 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted July 29, 2009 Author Share Posted July 29, 2009 @sparky, We are set to 'letter'. I'll let oempire try the changes first If we switch to A4 it makes the invoices look a bit funny as the aspect ratio of the paper is quite different. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 29, 2009 Share Posted July 29, 2009 @sparky, We are set to 'letter'. I'll let oempire try the changes first If we switch to A4 it makes the invoices look a bit funny as the aspect ratio of the paper is quite different. Lets try and rule this posibility out first and then we'll deal with the paper layout later. 0 Quote Link to comment Share on other sites More sharing options...
oempire Posted July 29, 2009 Share Posted July 29, 2009 ill give that a go sparky. We are already set to a4 here ill try the 'PrintScaling' => 'AppDefault', to 'PrintScaling' => 'None', tweak 0 Quote Link to comment Share on other sites More sharing options...
oempire Posted August 15, 2009 Share Posted August 15, 2009 sparky i started chopping vaious things out each night. to try and find a fix. and when i finally removed the include call, and moved all the include data into the template it works fine. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 15, 2009 Share Posted August 15, 2009 sparky i started chopping vaious things out each night. to try and find a fix. and when i finally removed the include call, and moved all the include data into the template it works fine. I wouldnt have thought that would cause the problem!! Could someone else please try that as well to see if it solves it on their system as well... open a ticket and I'll incorporate the included file for you in the script to try it. 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted August 15, 2009 Author Share Posted August 15, 2009 We will be trying this also (been working with @oempire to fix this but he found it). We can manually merge the include file in. We won't be running invoices again for about a week so I'll report back once it's done. 0 Quote Link to comment Share on other sites More sharing options...
ffeingol Posted August 28, 2009 Author Share Posted August 28, 2009 @sparky, Just an update. We manually 'included' the file into the template and the blank PDF issue is now gone (yea). We're still exhausting PHP memory, but we'll tackle that as a separate issue. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 28, 2009 Share Posted August 28, 2009 Thanks for the update... I would not have thought that by including a file of variables would have caused that issue. I will update the main download on my site. 0 Quote Link to comment Share on other sites More sharing options...
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.