custom-code display-message & tcpdf actions have different behaviours

How to fix table formatting differences between custom-code and TCPDF actions in ChronoForms.

Overview

The issue occurs because TCPDF has limited support for certain HTML table attributes like bgcolor when converting HTML to PDF.
Ensure your HTML table code uses basic, supported tags like bgcolor correctly and validate for any HTML/PHP errors in your form that might affect PDF rendering.

Answered
teldrive teldrive 26 May, 2014
I appreciate if someone can help, pursuing to generate a table with different data collection i have detected different behaviours on custom-code display-message & tcpdf actions, my goal is get similar results of custom-code on tcpdf action
here is a simple code for testing in three different setup-actions
<table width="600" height="81" border="1" cellpadding="1" cellspacing="1" bordercolor="#000000">
<?php
for($i=0;$i<4;$i++){
?>
  <tr>
  <td   bgcolor="#CCCCCC"><strong> <?php echo $i; ?></strong></td>
    <td   bgcolor="#CCCCCC"><strong> title1</strong></td>
    <td ><?php echo $form->data['paper1']['posternombre']; ?></td>
    <td   bgcolor="#CCCCCC"><strong> title2</strong></td>
    <td ><?php echo $form->data['paper1']['seccionnombre']; ?></td>
    <td  bgcolor="#CCCCCC"><strong> title3</strong></td>
    <td ><?php echo $form->data['paper1']['tipo']; ?></td>
  </tr>
  <tr>
<?php
}
?>
  </table>

[attachment=1]Captura.JPG[/attachment]
and results for tcpdf action
[attachment=1]Captura1.JPG[/attachment]
Gr GreyHead 27 May, 2014
Hi teldrive,

it looks as though the TCPDF library doesn't support attributes like bgcolor="#CCCCCC" Have you tried using CSS instead?
Their help documents might give you some clues?

Bob
teldrive teldrive 28 May, 2014
Hi Bob, thanks by reply, i did some research, tcpdf supports on tables bgcolor="#FFFF00", can be checked at http://www.tcpdf.org/examples/example_061.phps
I did some progress getting that display message action shows same aspect than custom code action using a hidden field "html" and buffering all html code generated with php variables:
in custom code action
<?php
 ob_start();
?>
<html>
................
</html>
<?php
$form->data['html'] = ob_get_contents();
ob_end_clean();
?>

and after in display message action {html}
I tried this method with TCPDF but problem remains about hidding table border, due to is an external application i don't know if is tcpdf issue i follow seeking solution if you have any clue let me know................
</html>
<?php
$form->data['html'] = ob_get_contents();
ob_end_clean();
?>[/code]
and after in display message action {html}
but issue remains with tcpdf because unformats table, due to is an external application i don't know if is tcpdf issue i follow seeking solution if you have any clue let me know
teldrive teldrive 01 Jun, 2014
Answer
Hi Max, Bob
Finally I understood pdf conversión is a tricky issue I tried with http://www.fpdf.org/ and tcpdf libraries but then discovered what excelect job you have done with action tcpdf. I have found some HTML/Php errors on my form and finally is working fine, basic tags for tables as <bgcolor> are supported,
<td bgcolor="#CCCCCC" colspan="2"></td>

Thanks for your support😀
This topic is locked and no more replies can be posted.