Create an RTF File and Add Page Break Using PHP

Adding a page break on a rich text format file created using PHP is very easy. Just add “<br style=”page-break-before  :always” />

Note: This does not work on Wordpad Editor.

{code}

$string = ‘Page 1’;
$string .= ‘<br style=”page-break-before  :always” />’;
$string .= ‘Page 2’;
$string .= ‘<br style=”page-break-before  :always” />’;
$string .= ‘Page 3’;
$string .= ‘<br style=”page-break-before  :always” />’;

file_put_contents(“file.rtf”,$string);

{/code}

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPrint this pageEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *