KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using tcpdf to produce PDF's from HTML. Everything is working fine and when I view the PDF on my computer I can see it just fine, but for some reason when I look at the PDF on my iPhone it shows up blank. All I can see are the borders I created that contain values in them but there are no values showing. Here is my code require_once('/tcpdf/tcpdf/config/lang/eng.php'); require_once('/tcpdf/tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setLanguageArray($l); $pdf->SetFont('dejavusans', '', 10); $pdf->AddPage(); $html = file_get_contents('http://www.website.com/invoice.php?invoice_id='.$invoice_id); $pdf->writeHTML($html, true, false, true, false, ''); $pdf->lastPage(); $pdf->Output('/html/admin/emailattachements/invoice.pdf', 'F'); In that last line. I copy the PDF to that directory when I grab it later with an email script and sends it off to a customer. Edit: SOLVED I discovered it was the font I was using to produce the PDF. iPhone's can't read dejavusans :) I changed it to 'times' and it works fine Edit: Update Since this article I have had to create many more PDF's with tcpdf and while I can't really explain why some fonts were not working while others where I recently applied some of the suggestions over at http://www.tcpdf.org/fonts.php and applied $fontname = $pdf->addTTFfont('/path-to-font/DejaVuSans.ttf', 'TrueTypeUnicode', '', 32); By adding a font manually and setting the font file path and uploading the file manually I was able to get existing font's that did not work and actually get them to work.
Tags (comma-separated)
Save Edits
Cancel