Calc Builder Support

Calc Builder support
Public write access is disabled. Please login

PDF not formatted properly (does not open) 28.01.2015 17:49


My form prints out a stream of html data saved in a php variable ($results).
When I recall this variable inside the Before/After calculation for pdf print this is what I obtain by clicking on the pdf icon:

Firefox: an index.php page is opened, showing the correct values. But if I download the file (mpdf.pdf) then I can't open it with Acrobat Reader because "the file is not supported". In fact, by inspecting the file with a text editor I can see my html code and after few lines the %PDF-1.4% header that should be at the very beginning of the file, according to what is stated on the Adobe site.

Chrome: no file is opened.

IE: no file is opened.

You can see the demo form here:

Could you please let me know how I could solve this issue?

Thanks for the assistance


Re: PDF not formatted properly (does not open) 28.01.2015 19:07

when you say the form is printing a stream, maybe you're using echo instructions or var_dumps at your php code? that kind of instructions can break the pdf format, as they are executed before sending the contents to pdf library. The right way to print the html you have built is to place ##results## at your output section.

If this is not your case and you can't solve the issue, please place a ticket at the helpdesk sharing an access to your site and we'll take a look.

Moonsoft Team

Re: PDF not formatted properly (does not open) 29.01.2015 09:35


That's been a very easy fix!!! Thank you!
I deleted the echo $results, and replaced it with a ##results## inside the exit layout and now everything works perfectly. Sorry, I thought it was the same.

Also, do you eventually know if it is possible to customize the pdf filename? I could hard-code a little bit the library if necessary, but I don't know where to look for.

Thanks again for the nice component and the very efficient assistance!


Re: PDF not formatted properly (does not open) 29.01.2015 12:24

great it worked. When no name is set, the library saves the file with a default name. You can force the file name editing the source where the output is printed:


replace the last line
$mpdf->Output ();

for this one
$mpdf->Output ('yourfilename.pdf','I');

This should do the work.

Moonsoft Team

Re: PDF not formatted properly (does not open) 29.01.2015 15:46

Thanks, I created an override inside my template and it works perfectly.

Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback