/** * Generate and return PDF. * * Return the generated binary PDF content as a string. * * @return string */ public function save() { // The ultimate write call. We can try to recommit an then just proxy // the call. $this->commit(); return $this->driver->save(); }
/** * Render box border * * Render box border for the given bounding box with the given * styles. * * @param ezcDocumentPdfBoundingBox $space * @param array $styles * @param bool $renderTop * @param bool $renderBottom * @return void */ protected function renderBoxBorder(ezcDocumentPdfBoundingBox $space, array $styles, $renderTop = true, $renderBottom = true) { $topLeft = array($space->x - $styles['padding']->value['left'] - $styles['border']->value['left']['width'] / 2, $space->y - $styles['padding']->value['top'] - $styles['border']->value['top']['width'] / 2); $topRight = array($space->x + $styles['padding']->value['right'] + $styles['border']->value['right']['width'] / 2 + $space->width, $space->y - $styles['padding']->value['top'] - $styles['border']->value['top']['width'] / 2); $bottomRight = array($space->x + $styles['padding']->value['right'] + $styles['border']->value['right']['width'] / 2 + $space->width, $space->y + $styles['padding']->value['bottom'] + $styles['border']->value['bottom']['width'] / 2 + $space->height); $bottomLeft = array($space->x - $styles['padding']->value['left'] - $styles['border']->value['left']['width'] / 2, $space->y + $styles['padding']->value['bottom'] + $styles['border']->value['bottom']['width'] / 2 + $space->height); if ($styles['border']->value['left']['width'] > 0) { $this->driver->drawPolyline(array($topLeft, $bottomLeft), $styles['border']->value['left']['color'], $styles['border']->value['left']['width']); } if ($renderTop && $styles['border']->value['top']['width'] > 0) { $this->driver->drawPolyline(array($topLeft, $topRight), $styles['border']->value['top']['color'], $styles['border']->value['top']['width']); } if ($styles['border']->value['right']['width'] > 0) { $this->driver->drawPolyline(array($topRight, $bottomRight), $styles['border']->value['right']['color'], $styles['border']->value['right']['width']); } if ($renderBottom && $styles['border']->value['bottom']['width'] > 0) { $this->driver->drawPolyline(array($bottomRight, $bottomLeft), $styles['border']->value['bottom']['color'], $styles['border']->value['bottom']['width']); } }
/** * Construct driver * * Creates a new document instance maintaining all document context. * * @return void */ public function __construct() { parent::__construct(); // Do nothing in here, we can only instantiate the document on first // page creation, because we do not know about the page format // beforehand. $this->pages = array(); $this->document = null; }
/** * Construct driver * * Creates a new document instance maintaining all document context. * * @return void */ public function __construct() { parent::__construct(); $this->document = new DOMDocument('1.0'); $this->document->formatOutput = true; $this->svg = $this->document->createElementNS('http://www.w3.org/2000/svg', 'svg'); $this->svg = $this->document->appendChild($this->svg); $this->svg->setAttribute('version', '1.2'); $this->svg->setAttribute('streamable', 'true'); $this->pages = $this->document->createElement('g'); $this->pages = $this->svg->appendChild($this->pages); $this->pages->setAttribute('id', 'pages'); $metadata = $this->document->createElement('metadata'); $metadata = $this->svg->appendChild($metadata); $rdfNs = 'http://www.w3.org/1999/02/22-rdf-syntax-ns'; $rdf = $this->document->createElementNS($rdfNs, 'rdf:RDF'); $metadata->appendChild($rdf); $this->metadata = $this->document->createElementNS($rdfNs, 'rdf:Description'); $this->metadata = $rdf->appendChild($this->metadata); $this->setMetaData('creator', 'eZ Components - Document //autogen//'); }
/** * Construct driver * * Creates a new document instance maintaining all document context. * * @return void */ public function __construct() { parent::__construct(); $this->document = null; $this->pages = array(); $this->dummyDoc = null; }