Skip to content

Commit

Permalink
Update dompdfFactory.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Zukowsky committed Nov 3, 2014
1 parent aa7b15c commit 8d1cb4e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/dompdfmodule/Service/dompdfFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
class dompdfFactory implements FactoryInterface
{
protected static $initialized = false;

public function createService(ServiceLocatorInterface $serviceLocator)
{
// service is not shared
// but don't register constants each time

if (! self::$initialized) {
$config = $serviceLocator->get('config');
$userConfig = isset($config['dompdf']) ? $config['dompdf'] : array();
self::$initialized = true;

$dompdfConfig = array_merge($this->createDefaultSettings(), $userConfig);

foreach ($dompdfConfig as $settingName => $settingValue) {
if (! defined($settingName)) {
define($settingName, $settingValue);
Expand All @@ -34,7 +34,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
$dompdf = new DOMPDF();
return $dompdf;
}

/**
* Some settings can be evaluated by default.
* @return array
Expand All @@ -50,13 +50,14 @@ protected function createDefaultSettings()
'DOMPDF_FONT_CACHE' => $dompdfDir . '/lib/fonts',
'DOMPDF_INC_DIR' => $dompdfDir . '/include',
'DOMPDF_LIB_DIR' => $dompdfDir . '/lib',

'DOMPDF_CHROOT' => '',
'DOMPDF_LOG_OUTPUT_FILE' => 'data/dompdf.log',
'DOMPDF_LOG_OUTPUT_FILE' => false,
'DOMPDF_DEFAULT_MEDIA_TYPE' => 'screen',
'DOMPDF_DEFAULT_PAPER_SIZE' => 'A4',
'DOMPDF_DEFAULT_FONT' => 'serif',
'DOMPDF_DPI' => 96,
'DOMPDF_PDF_BACKEND' => 'CPDF',
'DOMPDF_FONT_HEIGHT_RATIO' => 1.1,
'DOMPDF_UNICODE_ENABLED' => true,
'DOMPDF_ENABLE_PHP' => false,
Expand All @@ -65,7 +66,7 @@ protected function createDefaultSettings()
'DOMPDF_ENABLE_JAVASCRIPT' => false,
'DOMPDF_ENABLE_HTML5PARSER' => true,
'DOMPDF_ENABLE_FONTSUBSETTING' => false,

'DEBUGPNG' => false,
'DEBUGKEEPTEMP' => false,
'DEBUGCSS' => false,
Expand All @@ -74,7 +75,7 @@ protected function createDefaultSettings()
'DEBUG_LAYOUT_BLOCKS' => false,
'DEBUG_LAYOUT_INLINE' => false,
'DEBUG_LAYOUT_PADDINGBOX' => false,

'DOMPDF_ADMIN_USERNAME' => 'admin',
'DOMPDF_ADMIN_PASSWORD' => 'p4$$w0rd',
);
Expand Down

0 comments on commit 8d1cb4e

Please sign in to comment.