21_Pdf_TCPDF.php 667 B

1234567891011121314151617181920
  1. <?php
  2. use PhpOffice\PhpSpreadsheet\IOFactory;
  3. use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
  4. require __DIR__ . '/../Header.php';
  5. $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
  6. $helper->log('Hide grid lines');
  7. $spreadsheet->getActiveSheet()->setShowGridLines(false);
  8. $helper->log('Set orientation to landscape');
  9. $spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE);
  10. $className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf::class;
  11. $helper->log("Write to PDF format using {$className}");
  12. IOFactory::registerWriter('Pdf', $className);
  13. // Save
  14. $helper->write($spreadsheet, __FILE__, ['Pdf']);