ZealousWeb Generate PDF using contact form 7 linebreak

13 hours ago 4
ARTICLE AD BOX

If youre using this plugin and youre using localstorage to put your data into the pdf, and you want to have a linebreak but cant, because joining <br> comes back as text and \n isnt supported by the pdf you can put in a single line of code and poof, you can put \n inbetween to create line breaks.

in:

generate-pdf-using-contact-form-7/inc/front/class.cf7.generation.front.action.php

Swap at around line 340:

$html = $msg_body; $html = apply_filters( 'cf7_pdf_message_body', $html, $wpcf, $submission ); if (strpos($html, '<table') === false) { $html = nl2br($html); }

with:

$html = $msg_body; $html = apply_filters( 'cf7_pdf_message_body', $html, $wpcf, $submission ); $html = str_replace(array("\r\n", "\r", "\n"), '<br>', $html); if (strpos($html, '<table') === false) { $html = nl2br($html); }
Read Entire Article