Forums

TCPDF customization

giupi 16 Mar, 2018
Hello,

I was wondering if there is a way to customize the TCPDF file content; I would like that the pdf file sent to the user that fills the form, could contain some custom layout.

In particular I would like to get a pdf file where I can choose where to put my custom fields: i.e. I'd like to divide in four the A4 pdf so people by folding it in 4 can get a sort of badge (with his/her name and other fields) and other 3 useful parts.

In that way the fileds should be centered in one quarter of the A4; in other parts of the pdf there should be some other custom content (i.e. general info, map image, whatever...).

I tried to put a table (2 colums, 2 rows each 50%) in the TCPDF content but it does not spread equally.

Is there a way to have it?

Thanks in advance

Giuseppe
Max_admin 20 Mar, 2018
Answer
Hi Giuseppe,

Please try to use inline css in the table code, or even include the css above the table code:
<table style="width:100%">
<tr>
<td style="width:50%"></td><td></td>
</tr>
<tr></tr>
</table>
You may also try to set the "min-width" and "min-height" styles.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giupi 20 Mar, 2018
Hello,

thanks for your reply and your very useful suggestion.

Actually I could manage to get the (TC)pdf A4 splitted in 4 identical cells each 50% wide and 420px high (more or less is 11 cm - height 50% does not work); the printed A4 paper perfectly folds in 4. I also managed to include an image in one cell and that's amazing!

What I would like to improve is the fact that the text does not vertically center (only horizontally); this is the code I used in the TCPDF setting:
<table style="width: 100%;" border="1">
<tbody>
<tr>
<td style="valign: middle; text-align: center; width: 50%; height: 430px; vertical-align: middle;">{data:first_name}</td>
<td style="valign: middle; text-align: center; width: 50%; height: 430px; vertical-align: middle;">Nome {data:email}</td>
</tr>
<tr>
<td style="valign: middle; text-align: center; width: 50%; height: 430px; vertical-align: middle;"><img src="../media/k2/items/cache/ee760d1c1474fde7f8f71a96b2452e29_XL.jpg" alt="" width="200" height="100" /></td>
<td style="valign: middle; text-align: center; width: 50%; height: 430px; vertical-align: middle;">Nome {data:email}</td>
</tr>
</tbody>
</table>
The text actually vertically centers in the WYSIWYG TCPDF editor, but it does not in the final TCPDF. Is there a way to have it vertically centered?

Another question about TCPD: is there a way to set a left/right margin? It would be great if I could manage to set the at 0.

Thanks in advance.

PS I noticed a wierd behaviour in TCPDF: when I change some TCPFD setting in the form setup section, I must "save and close" the form, otherwise the TCPDF modifications does not take place in the form if I only just "save"
Max_admin 22 Mar, 2018
Hi giupi,

I think that the TCPDF CSS parser may have some limitations, I'm not sure, you can try a different CSS trick for vertical centering.

I think the margins can be changed but it may take sometime to add support for this.

This happens with the TCPDF action only ? it applies for all the settings ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giupi 22 Mar, 2018
Hello, thanks. Ok I'll make do with actual TCPDF features :-)

As far as the "save and close" question concerns, if I make some changes in TCPDF and I just "save", the form behaves as if the changes had not been done. I have to "save and close" the form for the TCPDF changes happens on the form. Just a wierd behaviour.

During the TCPDF table stuff tests I could not figure out why the changes I had just made were not shown on the form. Casually once I "saved and closed" the form and I noticed that the changes happened. I guess that it is just a TCPDF "bug"

Can you just tell me where could I poke around to find a TCPFD margin setting? I could just give a look and I may casually manage to get it... :-D

Thanks
Max_admin 24 Mar, 2018
Hi giupi,

Just tested the "Save" with TCPDF, and it works fine, the display is set to inline.

Also the margins are actually available for config under the "Advanced" tab in the TCPDF settings, are you sure that you have the latest update ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
giupi 24 Mar, 2018
Hum hum... er... yes you are right: I was expecting that I had to set the margin in some esoteric php code...🙄 I found the tab.

Thank you so much for your kind help and for this great component! :-)
This topic is locked and no more replies can be posted.