Advertisement
Guest User

export.php

a guest
Apr 27th, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.34 KB | None | 0 0
  1. <?php
  2.  
  3. // Include the main TCPDF library (search for installation path).
  4. require_once('tcpdf_include.php');
  5.  
  6. // create new PDF document
  7. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  8.  
  9. // set document information
  10. $pdf->SetCreator(PDF_CREATOR);
  11. $pdf->SetAuthor('Nicola Asuni');
  12. $pdf->SetTitle('TCPDF Example 058');
  13. $pdf->SetSubject('TCPDF Tutorial');
  14. $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  15.  
  16. // set default header data
  17. $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING);
  18.  
  19. // set header and footer fonts
  20. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  21. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  22.  
  23. // set default monospaced font
  24. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  25.  
  26. // set margins
  27. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  28. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  29. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  30.  
  31. // set auto page breaks
  32. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  33.  
  34. // set image scale factor
  35. $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  36.  
  37. // set some language-dependent strings (optional)
  38. if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
  39.     require_once(dirname(__FILE__).'/lang/eng.php');
  40.     $pdf->setLanguageArray($l);
  41. }
  42.  
  43. // ---------------------------------------------------------
  44.  
  45. // set font
  46. $pdf->SetFont('helvetica', '', 10);
  47.  
  48. // add a page
  49. $pdf->AddPage();
  50.  
  51. // NOTE: Uncomment the following line to rasterize SVG image using the ImageMagick library.
  52. //$pdf->setRasterizeVectorImages(true);
  53.  
  54. $pdf->ImageSVG("@".$_POST['svg'], $x=15, $y=30, $w=200);
  55.  
  56.  
  57. $pdf->SetFont('helvetica', '', 8);
  58. $pdf->SetY(195);
  59. $txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.';
  60. $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
  61.  
  62. // ---------------------------------------------------------
  63.  
  64. //Close and output PDF document
  65. $pdf->Output($_POST['filename'] . '.pdf', 'D');
  66.  
  67. //============================================================+
  68. // END OF FILE
  69. //============================================================+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement