php


Creating a Log File with DomPDF


I'm having a problem getting font-awesome to work inside of a DomPDF document on my webserver. However, the same HTML does work when using eclecticgeek.com's DomPDF debug helper. Therefore, I know there is not problem with the HTML. Here's a link to the working code:
http://eclecticgeek.com/dompdf/debug.php?identifier=d0c3b30ed7fd65fabb5c64dda47decc5
I am trying to populate DomPDF's log file on my local webserver to help isolate the issue, but no file is generating for me. Here's my full code, I am trying to set the log file via DomPDF's options, but am not sure I am doing it right.
<?php
require_once "sites/all/libraries/dompdf/autoload.inc.php";
use Dompdf\Dompdf;
$HTML = <<<HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Macondo" rel="stylesheet">
<style type="text/css">
.fa {
display: inline;
font-style: normal;
font-variant: normal;
font-weight: normal;
font-size: 14px;
line-height: 1;
font-family: FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
</head>
<body>
<p><span class="fa fa-envelope"></span> Font awesome doesn't work on my webserver</p>
<p style='font-family: "FontAwesome"'>  </p> <span> this also does not work </span>
<p style='font-family: "Macondo", cursive;'> This font works</p>
</body>
</html>
HTML;
$dompdf = new \Dompdf\Dompdf(array(
'tempDir' => 'sites/test.com/modules/CCPDF/',
'isRemoteEnabled' => true,
'isPhpEnabled' => true,
'isJavascriptEnabled' => true,
'pdfBackend' => "CPDF",
'isHtml5ParserEnabled' => true,
'logOutputFile' => 'sites/test.com/modules/CCPDF/test.log',
'DOMPDF_UNICODE_ENABLED' => true
));
$dompdf->load_html($HTML);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$dompdf->stream();
?>
Can anybody provide an example of how to properly set the DomPDF log file?
Here is a snippet of the PHP I use when I'm debugging locally.
ini_set('display_errors', true);
ini_set('error_log', 'output/tester.err.log');
ini_set('log_errors', true);
error_reporting(E_ALL);
$dompdf_options = array(
'chroot' => '/',
'logOutputFile' => __DIR__ . '/dompdf.log.html',
'isHtml5ParserEnabled' => true,
'debugPng' => false,
'debugKeepTemp' => false,
'debugCss' => false,
'debugLayout' => false,
'debugLayoutLines' => false,
'debugLayoutBlocks' => false,
'debugLayoutInline' => false,
'debugLayoutPaddingBox' => false
);
$_dompdf_show_warnings = true;
$_dompdf_debug = false;
$_DOMPDF_DEBUG_TYPES = [
'page-break' => false
];
$dompdf = new Dompdf\Dompdf($dompdf_options);
echo 'Running with ' , $dompdf->version , "\n";
$_dompdf_warnings = array();
echo 'Rendering '. $test_file . "\n";
$dompdf->load_html_file($test_file);
$dompdf->render();
file_put_contents(__DIR__ . '/' . basename($test_file) . (strtolower($dompdf_options['pdfBackend']) === 'gd' ? '.png' : '.pdf'), $dompdf->output(array('compress'=>0)));
You can play around with the debug settings to get different types of debug information.

Related Links

Checkbox that updates dynamically
PHP form submit not working on specific machine
Select a specific text form .TXT and group the content
Re-populate upload file field in codeigniter?
Returning the string after manipulating html by DOMDocument
Call to a member function whereHas() on a non-object in laravel
Compare Value to String IF/FOR Statement
PHP _COOKIE not set despite it being set in the cookie header
CodeIgniter not fetching entire field data
preg_split regex lookback for multiple matches
Paging URL rewriting not working in php using .htaccess
How to add calculated column to mysql query result in php?
merge/append json with different key
How to create a drop down menu by retrieving items in the 'itemname' column
Notice: Undefined offset: 1, 2, 3, 4 in dynamic_arr()
database values are not displaying in android spinner

Categories

HOME
php
knockout.js
weblogic12c
xcode
functional-programming
eclipse-plugin
transactions
iverilog
tabs
navigation
stored-procedures
cdi
wagtail
cisco
colors
nsstring
graphdb
chromecast
mailmerge
sonata
jpa-2.0
xbox360
bnf
reselect
hidden
playframework-2.0
android-custom-view
amazon-mws
opam
dashdb
neo4j.rb
qa
mod-wsgi
running-object-table
math.js
npoi
code-climate
adapter
docx4j
envoy
locks
publishing
python-2.x
caesar-cipher
sca
microsoft-certifications
cloudera-manager
ms-media-foundation
markov-chains
directfb
cmis
strapi
xll
hidden-markov-models
oauth2
plane
classnotfoundexception
apache-toree
xcode8.2
rightnow-crm
rm
scala-breeze
phppgadmin
deedle
test-data
glassfish-4.1
dex
google-identity-toolkit
fuzzer
visual-studio-monaco
unsigned
gnucash
xcopy
utf-16
openmrs
jsr363
helm
python-cffi
decidable
place
http.client
360-degrees
artisan
whitespace-language
python-curses
mxe
incron
operands
datagridcomboboxcolumn
rebar
relationships
object-code
lmax
network-printers
windows-messages
webaii
jomsocial
saga
frontbase
rautomation
virtual-channel
rikulo
delphi-xe4
examine
xmlwriter
email-verification
spark-view-engine
popup-blocker
voice-recording
navigationcontroller
will-paginate
boost-foreach
canonicalization
bll
downgrade
j2mepolish
fgetc
asdoc
resharper-5.0
dm
bucket
motif
isapi-redirect

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App