public function testRendering() { Ghostscript::setGsPath(); $f = new Ghostscript(); $this->assertFalse($f->render()); $filename = __DIR__ . DIRECTORY_SEPARATOR . 'support' . DIRECTORY_SEPARATOR . 'test.pdf'; $f->setInputFile($filename); $this->assertTrue($f->render()); unlink(dirname($filename) . DIRECTORY_SEPARATOR . 'output.png'); }
/** * Get the command-line that can be executed via exec * * @return string */ public function getRenderString() { if (null === $this->getInputFile()) { return ''; } $string = Ghostscript::getGsPath(); $string .= ' -dSAFER -dQUIET -dNOPLATFONTS -dNOPAUSE -dBATCH'; $string .= ' -sOutputFile="' . $this->getOutputFile() . '.' . $this->getDevice()->getFileEnding() . '"'; $string .= $this->getDevice()->getParameterString(); $string .= ' -r' . $this->getResolution(); if ($this->isTextAntiAliasingSet()) { $string .= ' -dTextAlphaBits=' . $this->getTextAntiAliasing(); } if ($this->isGraphicsAntiAliasingSet()) { $string .= ' -dGraphicsAlphaBits=' . $this->getGraphicsAntiAliasing(); } $string .= $this->getPageRangeString(); $string .= ' "' . $this->getInputFile() . '"'; return $string; }