tcpdf action changes format to text

Preserve HTML formatting when generating PDFs with the TCPDF action.

Overview

The TCPDF action strips HTML tags like
and

from text area content, causing the PDF to lose its intended formatting.
Use a custom code action before the TCPDF action to convert line breaks in the form data to HTML break tags, ensuring the formatting is correctly processed.

Answered
teldrive teldrive 13 May, 2014
I apreciate if anyone can help
I tested TCPDF and Works great but i detected it changes text format, eliminating "</br>" and <p> HTML codes , that changes significantly doc appearance
do i forgot some parameter, i checked everything?
 <br />
  Objetivos:<br />
  Análisis de la tasa .<br />
  Valoración de la </p>
<p>Material y métodos:<br />

[attachment=0]Captura.JPG[/attachment][attachment=1]Captura1.JPG[/attachment]
teldrive teldrive 13 May, 2014
[attachment=0]Captura1.JPG[/attachment]sorry this is the pdf output
Max_admin Max_admin 14 May, 2014
Hi Teldrive,

Did you add your html code to the content box in the TCPDF settings ? please try with something simple like:
<strong>bold text</strong>


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive teldrive 14 May, 2014
Hi Max, thanks by reply
I tested this simple code with just text-area field with same results

currently i have a HTML table organizing some fields
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<p align="center"><img src="http://congresoseden14.es/images/clip_image001.jpg" alt="" width="773" height="104" border="0" /></p>
<font face="times new roman" size="10">
<table width="600"  border="1" cellspacing="2">
<tbody>
<tr>
<td bgcolor="#CCCCCC"><strong>Comunicación</strong></td>
<td>{paper.posternombre}</td>
<td bgcolor="#CCCCCC"><strong>Sección</strong></td>
<td>{paper.seccionnombre}</td>
<td bgcolor="#CCCCCC"><strong>Tipo</strong></td>
<td>{paper.tiponombre}</td>
</tr>
<tr>
<td bgcolor="#CCCCCC"><strong>Título</strong></td>
<td colspan="5">{paper.titulo}</td>
</tr>

<tr>
<td bgcolor="#CCCCCC" colspan="6"> <strong>Resumen</strong></td>
</tr>
<tr>
<td colspan="6">{paper.resumen}</td>
</tr>
</tbody>
</table>
</font>
</body>
</html>
Max_admin Max_admin 14 May, 2014
Oh, you have <html> and <body> tags ? that may not work, please remove them and test with simple formatting html tags first ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive teldrive 14 May, 2014
Hi Max
our first test was following your advice
<strong>bold text</strong>

[attachment=0]Captura.JPG[/attachment]
teldrive teldrive 14 May, 2014
with this, results is the same
<HTML><strong>{paper.resumen}</strong></HTML>
Max_admin Max_admin 14 May, 2014
So formatted bold text is working fine ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive teldrive 15 May, 2014
Hi Max, so far results has been the same, tcpdf unformats text(eliminate <br> and <p> codes, we tested with simple HTML code as you suggested us
<strong>{paper.resumen}</strong>

<HTML><strong>{paper.resumen}</strong></HTML>

[attachment=0]Captura1.JPG[/attachment]
Max_admin Max_admin 20 May, 2014
Hi teldrive,

What if you enter this code in the TCPDF content box:

first line
<br>
2nd line


What do you get ? please test this static HTML, don't use your loaded code for now or any extra html tags!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive teldrive 20 May, 2014
Hi Max, following your suggestion, result is TCPDF maintains text format
[attachment=0]Captura.JPG[/attachment]
we also tried inserting this string into variable and passing it to tcpdf using {resumen}, results was fine
[attachment=1]Captura1.JPG[/attachment]
but the issue was in the next test:
1- we insert this test in text box[attachment=3]Captura3.JPG[/attachment]
2 -we checked with debug value of array and its maintain format[attachment=2]Captura2.JPG[/attachment]
3- but when converted to PDF, it changes format
[attachment=4]Captura4.JPG[/attachment]
teldrive teldrive 21 May, 2014
Answer
1 Likes
Thanks a lot Bob, it Works lika a charm 😀
<?php
 $form->data['input_name'] = nl2br($form->data['input_name']);
 ?>
This topic is locked and no more replies can be posted.