Forum
Calc Builder Support
Calc Builder supportForums
Public write access is disabled. Please login
PDF not formatted properly (does not open) 28.01.2015 17:49
Hi,
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.
http://helpx.adobe.com/acrobat/kb/pdf-error-1015-11001-update.html
Chrome: no file is opened.
IE: no file is opened.
You can see the demo form here: www.studioinvento.it/testpantano
Could you please let me know how I could solve this issue?
Thanks for the assistance
Elena
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.
http://helpx.adobe.com/acrobat/kb/pdf-error-1015-11001-update.html
Chrome: no file is opened.
IE: no file is opened.
You can see the demo form here: www.studioinvento.it/testpantano
Could you please let me know how I could solve this issue?
Thanks for the assistance
Elena
Re: PDF not formatted properly (does not open) 28.01.2015 19:07
Hi,
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.
thanks,
Moonsoft Team
www.moonsoft.es
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.
thanks,
Moonsoft Team
www.moonsoft.es
Re: PDF not formatted properly (does not open) 29.01.2015 09:35
Hi!
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!
Elena
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!
Elena
Re: PDF not formatted properly (does not open) 29.01.2015 12:24
hi,
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:
JOOMLA\components\com_calcbuilder\views\calcbuilder\tmpl\pdf.php
replace the last line
$mpdf->Output ();
for this one
$mpdf->Output ('yourfilename.pdf','I');
This should do the work.
regards
Moonsoft Team
www.moonsoft.es
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:
JOOMLA\components\com_calcbuilder\views\calcbuilder\tmpl\pdf.php
replace the last line
$mpdf->Output ();
for this one
$mpdf->Output ('yourfilename.pdf','I');
This should do the work.
regards
Moonsoft Team
www.moonsoft.es