diff --git a/lib/PHPPdf/Core/Formatter/StandardPositionFormatter.php b/lib/PHPPdf/Core/Formatter/StandardPositionFormatter.php index 22f440e1..a7a0e920 100644 --- a/lib/PHPPdf/Core/Formatter/StandardPositionFormatter.php +++ b/lib/PHPPdf/Core/Formatter/StandardPositionFormatter.php @@ -27,13 +27,16 @@ public function format(Nodes\Node $node, Document $document) list($x, $y) = $boundary->getFirstPoint()->toArray(); $attributesSnapshot = $node->getAttributesSnapshot(); - $diffWidth = $node->getWidth() - $attributesSnapshot['width']; - $width = $node->getWidth(); - $x += $width; + + $width = (isset($attributesSnapshot['width']) ? (int) $attributesSnapshot['width'] : 0); + + $diffWidth = $node->getWidth() - $width; + $nodeWidth = $node->getWidth(); + $x += $nodeWidth; $yEnd = $y - $node->getHeight(); $boundary->setNext($x, $y) ->setNext($x, $yEnd) - ->setNext($x - $width, $yEnd) + ->setNext($x - $nodeWidth, $yEnd) ->close(); if($node->hadAutoMargins()) @@ -42,4 +45,4 @@ public function format(Nodes\Node $node, Document $document) } } } -} \ No newline at end of file +}