PhpSpreadsheet/samples/21_Pdf_TCPDF.php
Adrien Crivelli 035281f04c
Basic test covering of all PDF writers
Third party PDF libraries must now be installed via composer and naturally
via composer autoloading mechanism. Because of that it is not necessary
to specify their path on disk. The usage is simplified and it allows us
to include them in our unit tests.

This also means that from now on PhpSpreadsheet must use composer autoloader
mechanism. The internal autoloading implementation was dropped.
2017-01-22 00:49:44 +09:00

18 lines
651 B
PHP

<?php
require __DIR__ . '/Header.php';
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
$helper->log('Hide grid lines');
$spreadsheet->getActiveSheet()->setShowGridLines(false);
$helper->log('Set orientation to landscape');
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
$helper->log("Write to PDF format using {$rendererName}");
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
// Save
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);