Forums

Textarea with linebraks in TCPDF

mobusag 19d ago

Title: Line breaks from textarea not respected in PDF output (ChronoForms8 / TCPDF)

Message:

Hi there,

I'm using ChronoForms8 and generating a PDF with TCPDF. I have a form with two textarea fields: "Billing Address" and "Delivery Address". In the PDF template, I'm using {data:rechnungsadresse} and {data:lieferadresse} to insert the content. However, line breaks from the textarea input are not preserved – everything appears in a single line in the generated PDF.

I tried using :html to convert the line breaks into <br />, but it doesn't seem to work inside the table cells.

Is there a proper way to display multiline textarea content with line breaks in the TCPDF output?

Thanks in advance for any tips!

Max_admin 19d ago
Answer

Hi mobusag

I have added this to the next update:

{data.br:field_name}

and it will convert new lines to line breaks

But for now you will need a PHP action:

return nl2br($this->data("field_name"));

then you can use {var:php_action_name} in your PDF template content

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mobusag 19d ago
1 Likes

hi Max

Thx, so i can wait for the next release.

CU

You need to login to be able to post a reply.