Custom font usage results in 135 Adobe error and PDF not rendered

2,011 views
Skip to first unread message

Amy Freelander

unread,
Dec 6, 2013, 6:52:57 AM12/6/13
to dom...@googlegroups.com
Hi,

I am making a fairly complex PDF with a custom font. It works perfectly on my dev machine, however on the live server any PDF generated when opened in Adobe Acrobat isn't rendered and the error message appears as "There was an error processing a page.  There was a problem reading this document. (135)". I have narrowed this down to the use of a custom font:

So given the following CSS (print2.css):

body, p {
    font-family: 'sourcesanspro', sans-serif;
}

And the following DOMPDF code:


<?php

require_once("/dompdf/dompdf_config.inc.php");

error_reporting(E_ALL);

session_start();

$fileName = "testFile.pdf";

ob_start();
echo '<html><head>
        <link rel="stylesheet" href="css/print2.css" type="text/css" />      
</head><body>
<div class="reportHeader">
<h1 class="reportTitle">Report Title</h1>
</div>
';

echo '<div>Testing 123</div></html>';

$html = ob_get_contents();

file_put_contents("pdfs/tmp", $html);
ob_end_clean();

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdfOutput = $dompdf->output();

file_put_contents($fileName, $pdfOutput);

echo $fileName;
?> 

The file can be opened absolutely fine using Chrome directly with the custom font in place but from the file system or downloaded and then opened in Adobe, a 135 error is displayed. I can only reproduce this on one server.

What's wrong with the setup of that one server?

Thanks,

Amy

BrianS

unread,
Dec 6, 2013, 3:07:16 PM12/6/13
to dom...@googlegroups.com
Is the font loaded using CSS @font declarations or did you install it into dompdf? If the latter and you copied your local install to the server you might try installing again on the server.

Also, sometimes PDFs become unreadable because PHP errors are captured in the PDF data stream. You can tell this by opening your PDF in a text editor (like Notepad). If the top of the file has PHP errors then that's the problem.

Amy Freelander

unread,
Dec 9, 2013, 11:53:06 AM12/9/13
to dom...@googlegroups.com
Hi,

Thanks for the speedy reply. I've checked the output- no errors. I've deleted the font files from lib/fonts and reinstalled. Still the 135 error persists.

If I were to change the CSS to use a font import statement instead, what do I need to be aware of? Are there going to be performance issues?

Do you have any other ideas as to why it might work on one server and not on the other? I don't know if / why it would matter but it works on an xampp stack on a Windows box but not on a wamp stack on a Windows box?!

Thanks,

Amy

Amy Freelander

unread,
Dec 9, 2013, 12:13:08 PM12/9/13
to dom...@googlegroups.com
Could there be something wrong with my ttf file?


On Friday, 6 December 2013 11:52:57 UTC, Amy Freelander wrote:

BrianS

unread,
Dec 17, 2013, 12:56:50 PM12/17/13
to dom...@googlegroups.com
You should not see a significant change in performance when using @font instead of loading in advance (except for the first time the font is accessed). You might try disabling font subsetting and see if that's the problem.

Sorry ... not always so speedy :/
Reply all
Reply to author
Forward
0 new messages