CalcBuilder Forum

mpdf.pdf file creation

User moon_1209 2013-10-27 22:25:01

I looking for the code where the pdf is made,
I want a diverent name for the pdf file is is now mpdf.pdf but like an other name
cant find the the creation of the file in the code

Moonsoft support 2013-10-28 09:59:54

hi,
the mpdf.pdf default name is created by mpdf library, you can find it here:

joomla\components\com_calcbuilder\views\calcbuilder\mpdf\mpdf.php


//line 5668

$name='mpdf.pdf';



Regards

User moon_1209 2013-10-28 16:12:14

I see


if(is_bool($dest)) $dest=$dest ? 'D' : 'F';
$dest=strtoupper($dest);
if($dest=='') {
if($name=='') {
$name='mpdf.pdf';
$dest='I';
}
else { $dest='F'; }
}


but where can I fount the call to this function in the calc builder code.

I want to save the PDF on the server and store the unic name in the session info
so i can tranfer the data to rf form for e-mailing

Moonsoft support 2013-10-28 16:32:11

Hi,
you won't find that specific call at calcbuilder code, mpdf is a library and only the main class is instanciated, all the handling is coded here:

joomla\components\com_calcbuilder\views\calcbuilder\tmpl\pdf.php

Here some information about mpdf library, so you can check the options available:

http://mpdf1.com/manual/index.php?tid=125

but we'd suggest instead to download the example from customer area:


Send Email with PDF

it shows the code needed to create a pdf file from calcbuilder code in order to attach it to an email, so you won't need to modify core code from mpdf.


Hope this helps, regards

User moon_1209 2013-10-28 21:33:58

I look at the sample but lookt to me like al lot of work to make a pdf that way from about 35 checkbox fields

so I look for the trigger of the pdf lib

there shout be a call to it after pressing calc of press the pdf button after the calc?

it lookes like ajax so it might be in som java file but i can't find it

Moonsoft support 2013-10-29 09:29:55

Hi, not sure of which point are you looking for, we think the best option is to write your custom code inside the calculator code, so here you have the path to pdf creation, every component is built using joomla mvc.

Starts at the module:

joomla\modules\mod_calcbuilder\tmpl\user.php

line 238

if ($utility) {


And then passes through the controller, to the view

joomla\components\com_calcbuilder\views\calcbuilder\tmpl\pdf.php

Hope this helps, regards
Moonsoft Team

User moon_1209 2013-10-31 00:59:17


And then passes through the controller, to the view

joomla\components\com_calcbuilder\views\calcbuilder\tmpl\pdf.php


I just make the folder:
/templates/"my_template"/html/com_calcbuilder/calcbuilder

and copy the pdf.php in it

change the last line of this file from
$mpdf->Output();
to
$mpdf->Output('invoice.pdf','D');

and I am happy

http://mpdf1.com/manual/index.php?tid=125


==========================================
In my calculation I got a var Name_1 how can I use it in the override

I want: $mpdf->Output(value(Name_1),'D');

I think i need somline like this
$mpdf->Output($this->calculo,'D');

but what is the correct programcode

Edited by moon_1209 - 31.10.2013 08:19

Moonsoft support 2013-10-31 09:42:29

Hi,
great it worked. At the layout you can't access variables calculated at previous layer, because they are already replaced at the content that's sent as the pdf output. If you don't want to track variables through all layers to add a new one, you can also use session to share values among different parts of your code.

Here official info about sessions in joomla:

http://docs.joomla.org/JFactory/getSession



Hope this helps, regards

User moon_1209 2013-10-31 09:52:17

¡gracias

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
List Manager

Build different lists for your site

Buy now!