Example #1
0
 public function testRenderUnknownElementsSilence()
 {
     $docbook = new ezcDocumentDocbook();
     $docbook->loadFile(dirname(__FILE__) . '/../files/pdf/unknown.xml');
     $options = new ezcDocumentPdfOptions();
     $options->errorReporting = E_PARSE;
     $renderer = new ezcDocumentPdfMainRenderer(new ezcDocumentPdfSvgDriver(), new ezcDocumentPcssStyleInferencer(), $options);
     $pdf = $renderer->render($docbook, new ezcDocumentPdfDefaultHyphenator());
     $errors = $renderer->getErrors();
     $this->assertEquals(1, count($errors));
     $this->assertEquals('Visitor error: Notice: \'Unknown and unhandled element: http://example.org/unknown:article.\' in line 0 at position 0.', reset($errors)->getMessage());
 }
Example #2
0
 /**
  * Create document from docbook document
  *
  * A document of the docbook format is provided and the internal document
  * structure should be created out of this.
  *
  * This method is required for all formats to have one central format, so
  * that each format can be compiled into each other format using docbook as
  * an intermediate format.
  *
  * You may of course just call an existing converter for this conversion.
  *
  * @param ezcDocumentDocbook $document
  * @return void
  */
 public function createFromDocbook(ezcDocumentDocbook $document)
 {
     if ($this->options->validate && $document->validateString($document) !== true) {
         $this->triggerError(E_WARNING, "You try to convert an invalid docbook document. This may lead to invalid output.");
     }
     $this->path = $document->getPath();
     $this->options->driver->setOptions($this->options);
     $renderer = new ezcDocumentPdfMainRenderer($this->options->driver, $this->styles, $this->options);
     foreach ($this->pdfParts as $part) {
         $renderer->registerPdfPart($part);
     }
     $this->content = $renderer->render($document, $this->options->hyphenator, $this->options->tokenizer);
     // Merge errors from renderer
     $this->errors = array_merge($this->errors, $renderer->getErrors());
 }