printPDF.tpl.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. $author = '';
  3. $PDFTitle = 'Átvételi elismervény / Acknowledgment of receipt';
  4. $PDFSubject = 'Átvételi elismervény / Acknowledgment of receipt';
  5. class MYPDF extends TCPDF {
  6. //Page header
  7. public function Header() {
  8. global $PDFTitle;
  9. // Logo
  10. //$image_file = K_PATH_IMAGES.'logo_example.jpg';
  11. //$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
  12. // Set font
  13. $this->SetFont('helvetica', 'B', 20);
  14. // Title
  15. $this->Cell(0, 15, $PDFTitle, 0, false, 'C', 0, '', 0, false, 'M', 'M');
  16. }
  17. // Page footer
  18. public function Footer() {
  19. // Position at 15 mm from bottom
  20. $this->SetY(-15);
  21. // Set font
  22. $this->SetFont('helvetica', 'I', 8);
  23. // Page number
  24. $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
  25. }
  26. }
  27. $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  28. // set document information
  29. $pdf->SetCreator(PDF_CREATOR);
  30. $pdf->SetAuthor($author);
  31. $pdf->SetTitle($PDFTitle);
  32. $pdf->SetSubject($PDFSubject);
  33. //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  34. // set default header data
  35. $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
  36. $pdf->setFooterData(array(0,64,0), array(0,64,128));
  37. // set header and footer fonts
  38. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  39. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  40. // set default monospaced font
  41. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  42. // set margins
  43. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  44. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  45. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  46. // set auto page breaks
  47. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  48. // set image scale factor
  49. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  50. // set some language-dependent strings (optional)
  51. if (@file_exists(dirname(__FILE__).'/lang/hun.php')) {
  52. require_once(dirname(__FILE__).'/lang/hun.php');
  53. $pdf->setLanguageArray($l);
  54. }
  55. $pdf->setFontSubsetting(true);
  56. $pdf->SetFont('dejavusans', '', 14, '', true);
  57. $pdf->AddPage();
  58. $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
  59. //$html = $toolsOfGroups[0]['ref'];
  60. $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
  61. $pdf->Output($PDFTitle.'.pdf', 'I');
  62. //============================================================+
  63. // END OF FILE
  64. //============================================================+