Canvas_Factory

Create canvas instances.

Defined (1)

The class is defined in the following location(s).

/lib/dompdf/include/canvas_factory.cls.php  
  1. class Canvas_Factory { 
  2.  
  3. /** 
  4. * Constructor is private: this is a static class 
  5. */ 
  6. private function __construct() { } 
  7.  
  8. /** 
  9. * @param DOMPDF $dompdf 
  10. * @param string|array $paper 
  11. * @param string $orientation 
  12. * @param string $class 
  13. * @return Canvas 
  14. */ 
  15. static function get_instance(DOMPDF $dompdf, $paper = null, $orientation = null, $class = null) { 
  16.  
  17. $backend = strtolower(DOMPDF_PDF_BACKEND); 
  18.  
  19. if ( isset($class) && class_exists($class, false) ) { 
  20. $class .= "_Adapter"; 
  21.  
  22. else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "pdflib" ) && 
  23. class_exists("PDFLib", false) ) { 
  24. $class = "PDFLib_Adapter"; 
  25.  
  26. // FIXME The TCPDF adapter is not ready yet 
  27. //else if ( (DOMPDF_PDF_BACKEND === "auto" || $backend === "cpdf") ) 
  28. // $class = "CPDF_Adapter"; 
  29.  
  30. else if ( $backend === "tcpdf" ) { 
  31. $class = "TCPDF_Adapter"; 
  32.  
  33. else if ( $backend === "gd" ) { 
  34. $class = "GD_Adapter"; 
  35.  
  36. else { 
  37. $class = "CPDF_Adapter"; 
  38.  
  39. return new $class($paper, $orientation, $dompdf);