PdfExport.class.php 820 B

123456789101112131415161718192021222324
  1. <?php
  2. require_once(__DIR__.SLASH.'HtmlExport.class.php');
  3. class PdfExport extends HtmlExport{
  4. public $mime = 'application/pdf';
  5. public $extension = 'pdf';
  6. public $description = 'Fichier informations PDF';
  7. public function sample($dataset, $level=0, $parent=''){
  8. $stream = parent::sample($dataset);
  9. $pdf = new Pdf($stream);
  10. $stream = $pdf->generate();
  11. return $stream;
  12. }
  13. public function end($stream, $datas, $options){
  14. $margin = isset($options['options']['margin']) ? $options['options']['margin'] : array();
  15. $format = isset($options['options']['format']) ? $options['options']['format'] : 'A4';
  16. $orientation = isset($options['options']['orientation']) ? $options['options']['orientation'] : 'Portrait';
  17. $pdf = new Pdf($stream, $margin, $format, $orientation);
  18. return $pdf->generate();
  19. }
  20. }
  21. ?>