/** * add a PNG image into the document, from a file * this should work with remote files */ function addSvgFromFile($file, $x, $y, $w = 0, $h = 0) { $doc = new \Svg\Document(); $doc->loadFile($file); $dimensions = $doc->getDimensions(); $this->save(); $this->transform(array($w / $dimensions["width"], 0, 0, $h / $dimensions["height"], $x, $y)); $surface = new \Svg\Surface\SurfaceCpdf($doc, $this); $doc->render($surface); $this->restore(); }