Okay, I am struggling here. For whatever reason, when using Cell or MultiCell, I can't get the spaces in my test to be written out...
I am 100% new to FPDF and FPDI, etc. I am using both, as I need to use a template. Below is the code I have so far:
$pdf = new FPDI('P', 'pt', 'Letter');
$templatePage = $pdf->importPage(1);
$pdf->useTemplate($templatePage, 0, 0, 0, 0, true);
$pdf->SetFont('Arial', 'B', 28);
$pdf->SetTextColor(159, 31, 32);
$pdf->SetDrawColor(159, 31, 32);
$pdf->MultiCell(0, 15, '2002 Baja 250 Islander Center Console', 0, 'C', false);
$pdf->Output(Configuration::LOCAL_OUTPUT_FOLDER . 'pdf/test.pdf', 'I');
Anyone with more experience on this than I, please help me. I haven't found anything in my searches that explains this output weirdness.
Can you provide more information about the problem. As far as I can see the output is being produced exactly as specified. Just which part isn't working the way you want?
On my screen, the text "2002 Baja 250 Islander Center Console" shows up as "2002Baja250IslanderCenterConsole". The spaces are removed... Does that not happen for anyone else?
Well what do you know. Seems Chrome's built in PDF viewer may be doing this to me. I opened it in Opera and the text shows up correctly.
It seems this is a known bug in Chrome: http://code.google.com/p/chromium/issues/detail?id=53553
Are you using the Arial font that comes with FPDF? I've had some kerning problems with FPDF in the past and it's not easy to solve without messing around in all sorts of weird character definition files.
I did find this site which will create definition files for a font you supply that works pretty well http://fpdf.fruit-lab.de/index.php?id=3
Altough if you use the default supplied font that should work just fine.
Does the problem also occur on different font sizes btw?
Yes, I am using the built in Arial font. Simply because it was there and I didn't want to mess with definition files (being my first use of FPDF). Happens at all font sizes.
Not sure if it occurs in Safari, but I'm not worried, as I just changed the output from inline to download, so the user will be required to save it before opening (thus it should open in their default pdf reader application, not Chrome).
This topic is now closed. New replies are no longer allowed.