Reputation: 551
I'm using FPDF to generate PDF. I use a PDF template created on Adobe Acrobat that include form inputs.
I've been using the following code to generate my pdf :
<?php
***************************
Sample using a PHP array
****************************/
require('fpdm.php');
$fields = array(
'date' => '07/07/2017',
'names' => 'Something',
);
$pdf = new FPDM('Singlepage.pdf');
$pdf->Load($fields, true); // second parameter: false if field values are in ISO-8859-1, true if UTF-8
$pdf->Merge();
$pdf->Output();
?>
It's working perfectly but now i'd like to add multiples lines to my "names"
form. Something like 'names' => 'Someone1 \n Someone2
But I can't figure out how to do it.
On my pdf template, I added the "multiples lines" to the text input.
Do you have any idea ?
And then i'd like to format this text, so I could add bold, italic etc to the text
Upvotes: 1
Views: 548
Reputation: 15912
The problem are the single quotes, change to double quotes and it will work (if the field is multi-line, of course):
$fields = array(
'date' => '07/07/2017',
'names' => "Something \n more",
);
Upvotes: 1