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

Public Member Functions

 __construct (PHPExcel $phpExcel)
 Create a new PHPExcel_Writer_PDF. More...
 
 save ($pFilename=NULL)
 Save PHPExcel to file. More...
 
- Public Member Functions inherited from PHPExcel_Writer_PDF_Core
 __construct (PHPExcel $phpExcel)
 Create a new PHPExcel_Writer_PDF. More...
 
 getFont ()
 Get Font. More...
 
 setFont ($fontName)
 Set font. More...
 
 getPaperSize ()
 Get Paper Size. More...
 
 setPaperSize ($pValue=PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
 Set Paper Size. More...
 
 getOrientation ()
 Get Orientation. More...
 
 setOrientation ($pValue=PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
 Set Orientation. More...
 
 getTempDir ()
 Get temporary storage directory. More...
 
 setTempDir ($pValue='')
 Set temporary storage directory. More...
 
- Public Member Functions inherited from PHPExcel_Writer_HTML
 __construct (PHPExcel $phpExcel)
 Create a new PHPExcel_Writer_HTML. More...
 
 save ($pFilename=null)
 Save PHPExcel to file. More...
 
 getSheetIndex ()
 Get sheet index. More...
 
 setSheetIndex ($pValue=0)
 Set sheet index. More...
 
 getGenerateSheetNavigationBlock ()
 Get sheet index. More...
 
 setGenerateSheetNavigationBlock ($pValue=true)
 Set sheet index. More...
 
 writeAllSheets ()
 Write all sheets (resets sheetIndex to NULL) More...
 
 generateHTMLHeader ($pIncludeStyles=false)
 Generate HTML header. More...
 
 generateSheetData ()
 Generate sheet data. More...
 
 generateNavigation ()
 Generate sheet tabs. More...
 
 generateStyles ($generateSurroundingHTML=true)
 Generate CSS styles. More...
 
 buildCSS ($generateSurroundingHTML=true)
 Build CSS styles. More...
 
 generateHTMLFooter ()
 Generate HTML footer. More...
 
 getImagesRoot ()
 Get images root. More...
 
 setImagesRoot ($pValue='.')
 Set images root. More...
 
 getEmbedImages ()
 Get embed images. More...
 
 setEmbedImages ($pValue='.')
 Set embed images. More...
 
 getUseInlineCss ()
 Get use inline CSS? More...
 
 setUseInlineCss ($pValue=false)
 Set use inline CSS? More...
 
 formatColor ($pValue, $pFormat)
 Add color to formatted string as inline style. More...
 
- Public Member Functions inherited from PHPExcel_Writer_Abstract
 getIncludeCharts ()
 Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object. More...
 
 setIncludeCharts ($pValue=FALSE)
 Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PHPExcel object. More...
 
 getPreCalculateFormulas ()
 Get Pre-Calculate Formulas flag If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet viewer when opening the file If false, then formulae are not calculated on save. More...
 
 setPreCalculateFormulas ($pValue=TRUE)
 Set Pre-Calculate Formulas Set to true (the default) to advise the Writer to calculate all formulae on save Set to false to prevent precalculation of formulae on save. More...
 
 getUseDiskCaching ()
 Get use disk caching where possible? More...
 
 setUseDiskCaching ($pValue=FALSE, $pDirectory=NULL)
 Set use disk caching where possible? More...
 
 getDiskCachingDirectory ()
 Get disk caching directory. More...
 
 save ($pFilename=NULL)
 Save PHPExcel to file. More...
 

Additional Inherited Members

- Protected Member Functions inherited from PHPExcel_Writer_PDF_Core
 prepareForSave ($pFilename=NULL)
 Save PHPExcel to PDF file, pre-save. More...
 
 restoreStateAfterSave ($fileHandle)
 Save PHPExcel to PDF file, post-save. More...
 
- Protected Attributes inherited from PHPExcel_Writer_PDF_Core
 $_tempDir = ''
 
 $_font = 'freesans'
 
 $_orientation = NULL
 
 $_paperSize = NULL
 
- Protected Attributes inherited from PHPExcel_Writer_HTML
 $_phpExcel
 
 $_isPdf = false
 
- Protected Attributes inherited from PHPExcel_Writer_Abstract
 $_includeCharts = FALSE
 
 $_preCalculateFormulas = TRUE
 
 $_useDiskCaching = FALSE
 
 $_diskCachingDirectory = './'
 
- Static Protected Attributes inherited from PHPExcel_Writer_PDF_Core
static $_paperSizes
 

Detailed Description

Definition at line 45 of file tcPDF.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Writer_PDF_tcPDF::__construct ( PHPExcel  $phpExcel)

Create a new PHPExcel_Writer_PDF.

Parameters
PHPExcel$phpExcelPHPExcel object

Reimplemented from PHPExcel_Writer_PDF_Core.

Definition at line 52 of file tcPDF.php.

53 {
54 parent::__construct($phpExcel);
55 }

Member Function Documentation

◆ save()

PHPExcel_Writer_PDF_tcPDF::save (   $pFilename = NULL)

Save PHPExcel to file.

Parameters
string$pFilenameName of the file to save as
Exceptions
PHPExcel_Writer_Exception

Implements PHPExcel_Writer_IWriter.

Definition at line 63 of file tcPDF.php.

64 {
65 $fileHandle = parent::prepareForSave($pFilename);
66
67 // Default PDF paper size
68 $paperSize = 'LETTER'; // Letter (8.5 in. by 11 in.)
69
70 // Check for paper size and page orientation
71 if (is_null($this->getSheetIndex())) {
72 $orientation = ($this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation()
74 ? 'L'
75 : 'P';
76 $printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
77 $printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
78 } else {
79 $orientation = ($this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
81 ? 'L'
82 : 'P';
83 $printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
84 $printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
85 }
86
87 // Override Page Orientation
88 if (!is_null($this->getOrientation())) {
90 ? 'L'
91 : 'P';
92 }
93 // Override Paper Size
94 if (!is_null($this->getPaperSize())) {
95 $printPaperSize = $this->getPaperSize();
96 }
97
98 if (isset(self::$_paperSizes[$printPaperSize])) {
99 $paperSize = self::$_paperSizes[$printPaperSize];
100 }
101
102
103 // Create PDF
104 $pdf = new TCPDF($orientation, 'pt', $paperSize);
105 $pdf->setFontSubsetting(FALSE);
106 // Set margins, converting inches to points (using 72 dpi)
107 $pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
108 $pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72);
109
110 $pdf->setPrintHeader(FALSE);
111 $pdf->setPrintFooter(FALSE);
112
113 $pdf->AddPage();
114
115 // Set the appropriate font
116 $pdf->SetFont($this->getFont());
117 $pdf->writeHTML(
118 $this->generateHTMLHeader(FALSE) .
119 $this->generateSheetData() .
120 $this->generateHTMLFooter()
121 );
122
123 // Document info
124 $pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
125 $pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
126 $pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
127 $pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
128 $pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
129
130 // Write to file
131 fwrite($fileHandle, $pdf->output($pFilename, 'S'));
132
133 parent::restoreStateAfterSave($fileHandle);
134 }
generateHTMLFooter()
Generate HTML footer.
Definition: HTML.php:1004
getSheetIndex()
Get sheet index.
Definition: HTML.php:255
generateHTMLHeader($pIncludeStyles=false)
Generate HTML header.
Definition: HTML.php:305
generateSheetData()
Generate sheet data.
Definition: HTML.php:356
getFont()
Get Font.
Definition: Core.php:231
getPaperSize()
Get Paper Size.
Definition: Core.php:256
getOrientation()
Get Orientation.
Definition: Core.php:278
PHP class for generating PDF documents without requiring external extensions.
Definition: tcpdf.php:134
$pdf
Definition: example_001.php:31

References $pdf, PHPExcel_Writer_HTML\generateHTMLFooter(), PHPExcel_Writer_HTML\generateHTMLHeader(), PHPExcel_Writer_HTML\generateSheetData(), PHPExcel_Writer_PDF_Core\getFont(), PHPExcel_Writer_PDF_Core\getOrientation(), PHPExcel_Writer_PDF_Core\getPaperSize(), PHPExcel_Writer_HTML\getSheetIndex(), and PHPExcel_Worksheet_PageSetup\ORIENTATION_LANDSCAPE.

+ Here is the call graph for this function:

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