4 * @link http://dompdf.github.com/
5 * @author Benj Carson <benjcarson@digitaljunkies.ca>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
11 * Create canvas instances
13 * The canvas factory creates canvas instances based on the
14 * availability of rendering backends and config options.
21 * Constructor is private: this is a static class
23 private function __construct()
28 * @param Dompdf $dompdf
29 * @param string|array $paper
30 * @param string $orientation
31 * @param string $class
35 static function get_instance(Dompdf
$dompdf, $paper = null, $orientation = null, $class = null)
37 $backend = strtolower($dompdf->get_option('pdf_backend'));
39 if (isset($class) && class_exists($class, false)) {
42 if (($backend === "auto" ||
$backend === "pdflib") &&
43 class_exists("PDFLib", false)
45 $class = "Dompdf\\Adapter\\PDFLib";
49 if ($backend === "gd") {
50 $class = "Dompdf\\Adapter\\GD";
52 $class = "Dompdf\\Adapter\\CPDF";
57 return new $class($paper, $orientation, $dompdf);