ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTCPDFGenerator Class Reference

Class ilTCPDFGenerator. More...

+ Collaboration diagram for ilTCPDFGenerator:

Static Public Member Functions

static generatePDF (ilPDFGenerationJob $job)
 

Detailed Description

Class ilTCPDFGenerator.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file class.ilTCPDFGenerator.php.

Member Function Documentation

◆ generatePDF()

static ilTCPDFGenerator::generatePDF ( ilPDFGenerationJob  $job)
static

Definition at line 13 of file class.ilTCPDFGenerator.php.

References $result, ilPDFGenerationJob\getAuthor(), ilPDFGenerationJob\getAutoPageBreak(), ilPDFGenerationJob\getCreator(), ilPDFGenerationJob\getFilename(), ilPDFGenerationJob\getImageScale(), ilPDFGenerationJob\getKeywords(), ilPDFGenerationJob\getMarginBottom(), ilPDFGenerationJob\getMarginLeft(), ilPDFGenerationJob\getMarginRight(), ilPDFGenerationJob\getMarginTop(), ilPDFGenerationJob\getOutputMode(), ilPDFGenerationJob\getPages(), ilPDFGenerationJob\getSubject(), and ilPDFGenerationJob\getTitle().

Referenced by ilPDFGeneration\doJob().

14  {
15  require_once 'tcpdf/tcpdf.php';
16 
17  // create new PDF document
18  $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
19 
20  // set document information
21  $pdf->SetCreator( $job->getCreator() );
22  $pdf->SetAuthor( $job->getAuthor() );
23  $pdf->SetTitle( $job->getTitle() );
24  $pdf->SetSubject( $job->getSubject() );
25  $pdf->SetKeywords( $job->getKeywords() );
26 
27  //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING); // TODO
28  $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); // TODO
29  $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // TODO
30  $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // TODO
31  $pdf->SetMargins($job->getMarginLeft(), $job->getMarginTop(), $job->getMarginRight());
32  $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); // TODO
33  $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // TODO
34  $pdf->SetAutoPageBreak($job->getAutoPageBreak(), $job->getMarginBottom());
35  $pdf->setImageScale($job->getImageScale());
36  $pdf->SetFont('dejavusans', '', 10); // TODO
37 
38  /* // TODO
39  // set some language-dependent strings (optional)
40  if (file_exists(dirname(__FILE__).'/lang/eng.php')) {
41  require_once(dirname(__FILE__).'/lang/eng.php');
42  $pdf->setLanguageArray($l);
43  }
44  */
45  // set font
46 
47  foreach ($job->getPages() as $page)
48  {
49  $pdf->AddPage();
50  $pdf->writeHTML($page, true, false, true, false, '');
51  }
52 
53  $result = $pdf->Output($job->getFilename(), $job->getOutputMode() ); // (I - Inline, D - Download, F - File)
54  }
$result
PHP class for generating PDF documents without requiring external extensions.
Definition: tcpdf.php:184
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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