FillPdfExport.class.php 744 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class FillPdfExport{
  3. public $mime = 'application/pdf';
  4. public $extension = 'pdf';
  5. public $description = 'Fichier informations formulaire PDF';
  6. public function sample($dataset,$level = 0){
  7. return 'Aucun exemple disponible';
  8. }
  9. public function start($stream,&$datas){
  10. $datas = $this->encodeValue($datas);
  11. }
  12. public function encodeValue($datas){
  13. foreach ($datas as $key=>$data) {
  14. $datas[$key] = is_array($data) ? $this->encodeValue($data) : utf8_decode($data);
  15. }
  16. return $datas;
  17. }
  18. public function from_template($stream,$datas){
  19. $temp = str_replace('\\\\','\\',File::temp().rand(0,1000000));
  20. file_put_contents($temp, $stream );
  21. $stream = Pdf::fillData($temp,$datas);
  22. unlink($temp);
  23. return $stream;
  24. }
  25. }
  26. ?>