Special Characters in FPDF with PHP

Figured this out by doing the following (pagesubtitle is the name of the text field in the form):

$reportSubtitle = stripslashes($_POST['pagesubtitle']);
$reportSubtitle = iconv('UTF-8', 'windows-1252', $reportSubtitle);

Then print it out:

$pdf->Write (6, $reportSubtitle);

This will remove any unwanted slashes following apostrophes, as well as use the ‘iconv’ function to print special characters such as ™

Leave a Comment