PluginProbe
MBE eShip / trunk
MBE eShip vtrunk
2.8.1 trunk 1.0.0 1.1.0 1.1.3 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.7.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.2.1 All 37 releases
mail-boxes-etc / lib / dompdf / src / CanvasFactory.php

CanvasFactory.php in MBE eShip trunk, at lib/dompdf/src/CanvasFactory.php

59 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package dompdf
4 * @link https://github.com/dompdf/dompdf
5 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
6 */
7 namespace Dompdf;
8
9 /**
10 * Create canvas instances
11 *
12 * The canvas factory creates canvas instances based on the
13 * availability of rendering backends and config options.
14 *
15 * @package dompdf
16 */
17 class CanvasFactory
18 {
19 /**
20 * Constructor is private: this is a static class
21 */
22 private function __construct()
23 {
24 }
25
26 /**
27 * @param Dompdf $dompdf
28 * @param string|array $paper
29 * @param string $orientation
30 * @param string $class
31 *
32 * @return Canvas
33 */
34 static function get_instance(Dompdf $dompdf, $paper = null, $orientation = null, $class = null)
35 {
36 $backend = strtolower($dompdf->getOptions()->getPdfBackend());
37
38 if (isset($class) && class_exists($class, false)) {
39 $class .= "_Adapter";
40 } else {
41 if (($backend === "auto" || $backend === "pdflib") &&
42 class_exists("PDFLib", false)
43 ) {
44 $class = "Dompdf\\Adapter\\PDFLib";
45 }
46
47 else {
48 if ($backend === "gd" && extension_loaded('gd')) {
49 $class = "Dompdf\\Adapter\\GD";
50 } else {
51 $class = "Dompdf\\Adapter\\CPDF";
52 }
53 }
54 }
55
56 return new $class($paper, $orientation, $dompdf);
57 }
58 }
59