CMS  Version 3.9
PdfManager Class Reference

Provides a central management class for event handlers and common functionality for the pdf component. More...

Public Member Functions

 PdfManager ()
 

Static Public Member Functions

static setDefaults ()
 
static getTempDirectory ()
 
static preprocessTemplate ($template)
 
static createConvertor ($pdf)
 

Detailed Description

Provides a central management class for event handlers and common functionality for the pdf component.

Definition at line 15 of file pdf_manager.inc.

Member Function Documentation

◆ createConvertor()

static PdfManager::createConvertor (   $pdf)
static

Definition at line 53 of file pdf_manager.inc.

54  {
55  $mode = Settings::getValue("pdf", "PDF_convertor");
56  switch($mode)
57  {
58  case "external":
59  return new ExternalPDFConvertor($pdf);
60 
61  case "chrome":
62  return new ChromePDFConvertor($pdf);
63 
64  case "whtmktopdf":
65  default:
66  return new WkhtmltoPDFConvertor($pdf);
67  }
68  }
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104
$pdf
Definition: generate.inc:8
$mode

◆ getTempDirectory()

static PdfManager::getTempDirectory ( )
static

Definition at line 32 of file pdf_manager.inc.

33  {
34  global $config;
35 
36  $dir = $config["uploadbase"] . DIRECTORY_SEPARATOR . "pdf_tmp";
37 
38  if (!file_exists($dir))
39  {
40  mkdir($dir);
41  chmod($dir, 0777);
42  }
43 
44  return $dir;
45  }
$dir
Definition: delete.inc:44
global $config
Definition: import.inc:4

◆ PdfManager()

PdfManager::PdfManager ( )

Definition at line 17 of file pdf_manager.inc.

18  {
19 
20  }

◆ preprocessTemplate()

static PdfManager::preprocessTemplate (   $template)
static

Definition at line 47 of file pdf_manager.inc.

48  {
49  $convertor = PdfManager::createConvertor(null);
50  return $convertor->preProcessTemplate($template);
51  }
static createConvertor($pdf)
Definition: pdf_manager.inc:53

◆ setDefaults()

static PdfManager::setDefaults ( )
static

Definition at line 22 of file pdf_manager.inc.

23  {
24  Settings::setDefaultValue("pdf", "wkhtmltopdf_path", "wkhtmltopdf", String, "The path to the wkhtmltopdf executable on your system.", "PDF Settings", null, 2);
25  Settings::setDefaultValue("pdf", "PDF_convertor", "wkhtmltopdf", String, "Specifies the method used to convert HTML to PDF", "PDF Settings", "wkhtmltopdf\nchrome\nexternal", 1);
26  Settings::setDefaultValue("pdf", "chrome_path", "chrome", String, "The path to the chrome (or chromium) executable on your system", "PDF Settings", null, 3);
27  Settings::setDefaultValue("pdf", "chrome_screenshot_path", "", String, "Path to the screenshot script on your system", "PDF Settings", null, 4);
28  Settings::setDefaultValue("pdf", "external_PDF_url", "", String, "External URL to web-based PDF generator", "PDF Settings", null, 5);
29  Settings::setDefaultValue("pdf", "external_PNG_url", "", String, "External URL to web-based PNG generator", "PDF Settings", null, 5);
30  }
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
Definition: settings.inc:174

The documentation for this class was generated from the following file: