Skip to content

Commit

Permalink
Fix page size/origentation runtime configuration
Browse files Browse the repository at this point in the history
This fixes the previous commit, which was causing an internal inconsistency
between the Canvas and PDF properties of dompdf. We are still incomplete
functionally since we are wiping out the instances of the Canvas and
FontMetrics objects that were created on dompdf instantiation. Any actions
taken on the canvas object prior to rendering (e.g. CPDF page scripts) are
thus wiped out.

We should integrate the code from #613 so that Dompdf/CPDF is able to set
pages sizes dynamically. PDFLib support will have to be similarly updated.
  • Loading branch information
bsweeney committed Dec 8, 2014
1 parent ed95a74 commit 7a60569
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Dompdf/Dompdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,9 @@ public function render()
if (is_array($basePageStyle->size)) {
$this->setPaper(array(0, 0, $basePageStyle->size[0], $basePageStyle->size[1]));
}

$this->pdf = CanvasFactory::get_instance($this, $this->paperSize, $this->paperOrientation);

//TODO: We really shouldn't be doing this; properties were already set in the constructor. We should add Canvas methods to set the page size and orientation after instantiaion.
$this->setCanvas(CanvasFactory::get_instance($this, $this->paperSize, $this->paperOrientation));
$this->setFontMetrics(new FontMetrics($this->pdf, $this->getOptions()));

if ($this->options->isFontSubsettingEnabled() && $this->pdf instanceof CPDF) {
Expand Down

0 comments on commit 7a60569

Please sign in to comment.