Пример #1
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->setOptions(new Options());
     $this->localeStandard = sprintf('%.1f', 1.0) == '1.0';
     $this->saveLocale();
     $this->paperSize = $this->options->getDefaultPaperSize();
     $this->setCanvas(CanvasFactory::get_instance($this, $this->paperSize, $this->paperOrientation));
     $this->setFontMetrics(new FontMetrics($this->getCanvas(), $this->getOptions()));
     $this->css = new Stylesheet($this);
     $this->restoreLocale();
 }
Пример #2
0
 /**
  * Class constructor
  *
  * @param array $options
  */
 public function __construct($options = null)
 {
     mb_internal_encoding('UTF-8');
     $this->setOptions(new Options($options));
     $versionFile = realpath(__DIR__ . '/../VERSION');
     if (file_exists($versionFile) && ($version = file_get_contents($versionFile)) !== false && $version !== '$Format:<%h>$') {
         $this->version = sprintf('dompdf %s', $version);
     }
     $this->localeStandard = sprintf('%.1f', 1.0) == '1.0';
     $this->saveLocale();
     $this->paperSize = $this->options->getDefaultPaperSize();
     $this->setCanvas(CanvasFactory::get_instance($this, $this->paperSize, $this->paperOrientation));
     $this->setFontMetrics(new FontMetrics($this->getCanvas(), $this->getOptions()));
     $this->css = new Stylesheet($this);
     $this->restoreLocale();
 }
Пример #3
-1
 public function testSetters()
 {
     $option = new Options();
     $option->set(array('tempDir' => 'test1', 'fontDir' => 'test2', 'fontCache' => 'test3', 'chroot' => 'test4', 'logOutputFile' => 'test5', 'defaultMediaType' => 'test6', 'defaultPaperSize' => 'test7', 'defaultFont' => 'test8', 'dpi' => 300, 'fontHeightRatio' => 1.2, 'isPhpEnabled' => true, 'isRemoteEnabled' => true, 'isJavascriptEnabled' => false, 'isHtml5ParserEnabled' => true, 'isFontSubsettingEnabled' => true, 'debugPng' => true, 'debugKeepTemp' => true, 'debugCss' => true, 'debugLayout' => true, 'debugLayoutLines' => false, 'debugLayoutBlocks' => false, 'debugLayoutInline' => false, 'debugLayoutPaddingBox' => false, 'adminUsername' => 'test9', 'adminPassword' => 'test10'));
     $this->assertEquals('test1', $option->getTempDir());
     $this->assertEquals('test2', $option->getFontDir());
     $this->assertEquals('test3', $option->getFontCache());
     $this->assertEquals('test4', $option->getChroot());
     $this->assertEquals('test5', $option->getLogOutputFile());
     $this->assertEquals('test6', $option->getDefaultMediaType());
     $this->assertEquals('test7', $option->getDefaultPaperSize());
     $this->assertEquals('test8', $option->getDefaultFont());
     $this->assertEquals(300, $option->getDpi());
     $this->assertEquals(1.2, $option->getFontHeightRatio());
     $this->assertTrue($option->getIsPhpEnabled());
     $this->assertTrue($option->getIsRemoteEnabled());
     $this->assertFalse($option->getIsJavascriptEnabled());
     $this->assertTrue($option->getIsHtml5ParserEnabled());
     $this->assertTrue($option->getIsFontSubsettingEnabled());
     $this->assertTrue($option->getDebugPng());
     $this->assertTrue($option->getDebugKeepTemp());
     $this->assertTrue($option->getDebugCss());
     $this->assertTrue($option->getDebugLayout());
     $this->assertFalse($option->getDebugLayoutLines());
     $this->assertFalse($option->getDebugLayoutBlocks());
     $this->assertFalse($option->getDebugLayoutInline());
     $this->assertFalse($option->getDebugLayoutPaddingBox());
     $this->assertEquals('test9', $option->getAdminUsername());
     $this->assertEquals('test10', $option->getAdminPassword());
 }