ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTCPDFRenderer Class Reference
+ Inheritance diagram for ilTCPDFRenderer:
+ Collaboration diagram for ilTCPDFRenderer:

Public Member Functions

 __construct ()
 from ilPlugin More...
 
 addConfigElementsToForm (\ilPropertyFormGUI $form, $service, $purpose)
 from ilRendererConfig More...
 
 populateConfigElementsInForm (\ilPropertyFormGUI $form, $service, $purpose, $config)
 from ilRendererConfig More...
 
 validateConfigInForm (\ilPropertyFormGUI $form, $service, $purpose)
 from ilRendererConfig More...
 
 getConfigFromForm (\ilPropertyFormGUI $form, $service, $purpose)
 from ilRendererConfig More...
 
 getDefaultConfig ($service, $purpose)
 from ilRendererConfig More...
 
 generatePDF ($service, $purpose, $config, $job)
 from ilPDFRenderer More...
 

Protected Attributes

 $lng
 

Detailed Description

Definition at line 6 of file class.ilTCPDFRenderer.php.

Constructor & Destructor Documentation

◆ __construct()

ilTCPDFRenderer::__construct ( )

from ilPlugin

ilDummyRendererPlugin constructor.

Definition at line 16 of file class.ilTCPDFRenderer.php.

References $DIC.

17  {
18  global $DIC;
19  $this->lng = $DIC['lng'];
20  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ addConfigElementsToForm()

ilTCPDFRenderer::addConfigElementsToForm ( \ilPropertyFormGUI  $form,
  $service,
  $purpose 
)

from ilRendererConfig

Parameters
\ilPropertyFormGUI$form
string$service
string$purpose
Returns
|void

Implements ilRendererConfig.

Definition at line 31 of file class.ilTCPDFRenderer.php.

References ilPropertyFormGUI\addItem().

32  {
33  $margin_left = new ilTextInputGUI($this->lng->txt('margin_left'), 'margin_left');
34  $form->addItem($margin_left);
35 
36  $margin_top = new ilTextInputGUI($this->lng->txt('margin_top'), 'margin_top');
37  $form->addItem($margin_top);
38 
39  $margin_right = new ilTextInputGUI($this->lng->txt('margin_right'), 'margin_right');
40  $form->addItem($margin_right);
41 
42  $margin_bottom = new ilTextInputGUI($this->lng->txt('margin_bottom'), 'margin_bottom');
43  $form->addItem($margin_bottom);
44 
45  $image_scale = new ilTextInputGUI($this->lng->txt('image_scale'), 'image_scale');
46  $form->addItem($image_scale);
47  }
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
+ Here is the call graph for this function:

◆ generatePDF()

ilTCPDFRenderer::generatePDF (   $service,
  $purpose,
  $config,
  $job 
)

from ilPDFRenderer

Parameters
string$service
string$purpose
array$config
\ilPDFGenerationJob$job

Implements ilPDFRenderer.

Definition at line 136 of file class.ilTCPDFRenderer.php.

References $config, $pdf, $result, array, exit, PDF_FONT_MONOSPACED, PDF_FONT_NAME_DATA, PDF_FONT_NAME_MAIN, PDF_FONT_SIZE_DATA, PDF_FONT_SIZE_MAIN, PDF_MARGIN_FOOTER, PDF_MARGIN_HEADER, PDF_PAGE_FORMAT, PDF_PAGE_ORIENTATION, and PDF_UNIT.

137  {
138  require_once 'libs/composer/vendor/autoload.php';
139 
140  // create new PDF document
141  $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
142 
143  $pdf->SetMargins($config['margin_left'], $config['margin_top'], $config['margin_right']);
144  $pdf->SetAutoPageBreak('auto', $config['margin_buttom']);
145  $pdf->setImageScale($config['image_scale']);
146 
147  $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
148  $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
149  $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
150  $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
151  $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
152  $pdf->SetFont('dejavusans', '', 10);
153  $pdf->setSpacesRE('/[^\S\xa0]/'); // Fixing unicode/PCRE-mess #17547
154 
155  foreach ($job->getPages() as $page) {
156  $page = ' ' . $page;
157  $pdf->AddPage();
158  $pdf->writeHTML($page, true, false, true, false, '');
159  }
160  $result = $pdf->Output($job->getFilename(), $job->getOutputMode()); // (I - Inline, D - Download, F - File)
161 
162  if (in_array($job->getOutputMode(), array('I', 'D'))) {
163  exit();
164  }
165  }
const PDF_MARGIN_HEADER
Header margin.
$result
const PDF_FONT_SIZE_MAIN
Default main font size.
$pdf
Definition: example_001.php:31
const PDF_FONT_SIZE_DATA
Default data font size.
const PDF_FONT_NAME_MAIN
Default main font name.
PHP class for generating PDF documents without requiring external extensions.
Definition: tcpdf.php:134
const PDF_UNIT
Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
const PDF_PAGE_ORIENTATION
Page orientation (P=portrait, L=landscape).
Create styles array
The data for the language used.
const PDF_FONT_NAME_DATA
Default data font name.
const PDF_PAGE_FORMAT
Page format.
const PDF_FONT_MONOSPACED
Default monospaced font name.
const PDF_MARGIN_FOOTER
Footer margin.

◆ getConfigFromForm()

ilTCPDFRenderer::getConfigFromForm ( \ilPropertyFormGUI  $form,
  $service,
  $purpose 
)

from ilRendererConfig

Parameters
\ilPropertyFormGUI$form
string$service
string$purpose
Returns
array

Implements ilRendererConfig.

Definition at line 93 of file class.ilTCPDFRenderer.php.

References array, and ilPropertyFormGUI\getItemByPostVar().

94  {
95  $retval = array(
96  'margin_left' => $form->getItemByPostVar('margin_left')->getValue(),
97  'margin_right' => $form->getItemByPostVar('margin_right')->getValue(),
98  'margin_top' => $form->getItemByPostVar('margin_top')->getValue(),
99  'margin_bottom' => $form->getItemByPostVar('margin_bottom')->getValue(),
100  'image_scale' => $form->getItemByPostVar('image_scale')->getValue(),
101  );
102 
103  return $retval;
104  }
if(isset($_POST['submit'])) $form
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getDefaultConfig()

ilTCPDFRenderer::getDefaultConfig (   $service,
  $purpose 
)

from ilRendererConfig

Parameters
string$service
string$purpose
Returns
array

Implements ilRendererConfig.

Definition at line 115 of file class.ilTCPDFRenderer.php.

References array.

116  {
117  $retval = array(
118  'margin_left' => '10',
119  'margin_top' => '10',
120  'margin_right' => '10',
121  'margin_bottom' => '10',
122  'image_scale' => '1',
123  );
124 
125  return $retval;
126  }
Create styles array
The data for the language used.

◆ populateConfigElementsInForm()

ilTCPDFRenderer::populateConfigElementsInForm ( \ilPropertyFormGUI  $form,
  $service,
  $purpose,
  $config 
)

from ilRendererConfig

Parameters
\ilPropertyFormGUI$form
string$service
string$purpose
array$config
Returns
|void

Implements ilRendererConfig.

Definition at line 59 of file class.ilTCPDFRenderer.php.

References $config, and ilPropertyFormGUI\getItemByPostVar().

60  {
61  $form->getItemByPostVar('margin_left')->setValue($config['margin_left']);
62  $form->getItemByPostVar('margin_right')->setValue($config['margin_right']);
63  $form->getItemByPostVar('margin_top')->setValue($config['margin_top']);
64  $form->getItemByPostVar('margin_bottom')->setValue($config['margin_bottom']);
65  $form->getItemByPostVar('image_scale')->setValue($config['image_scale']);
66  }
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

◆ validateConfigInForm()

ilTCPDFRenderer::validateConfigInForm ( \ilPropertyFormGUI  $form,
  $service,
  $purpose 
)

from ilRendererConfig

Parameters
\ilPropertyFormGUI$form
string$service
string$purpose
Returns
bool

Implements ilRendererConfig.

Definition at line 77 of file class.ilTCPDFRenderer.php.

78  {
79  if (true) {
80  return true;
81  }
82  }

Field Documentation

◆ $lng

ilTCPDFRenderer::$lng
protected

Definition at line 9 of file class.ilTCPDFRenderer.php.


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