Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <!-- language: php -->
  2. <?php
  3. function fetch_data(){
  4. if (isset($_POST["create_pdf"])){
  5. require_once("tcpdf/tcpdf.php");
  6.  
  7. $obj_pdf = new TCPDF('P' , PDF_UNIT , PDF_PAGE_FORMAT true , 'UTF-8', false);
  8. $obj_pdf->SetCreator(PDF_CREATOR);
  9. $obj_pdf->SetTitle("Application");
  10. $obj_pdf->SetHeaderData('', '' , PDF_HEADER_TITLE, PDF_HEADER_STRING);
  11. $obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '' , PDF_FONT_SIZE_MAIN));
  12. $obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '' , PDF_FONT_SIZE_DATA));
  13. $obj_pdf->SetDefaultMonospacedFont('helvetica');
  14. $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  15. $obj_pdf->SetMargins(PDF_MARGIN_LEFT, '5' , PDF_MARGIN_RIGHT);
  16. $obj_pdf->setPrintHeader(false);
  17. $obj_pdf->setPrintFooter(false);
  18. $obj_pdf->SetAutoPageBreak(TRUE, 10);
  19. $obj_pdf->SetFont('helvetica' , '' , 12);
  20.  
  21.  
  22.  
  23. $obj_pdf->writeHTML("Hello world!");
  24. ob_end_clean();
  25. $obj_pdf->Output("sample.pdf" , "I");
  26.  
  27. }
  28. }
  29. echo "<form method = 'post'>
  30. <input type='submit' name='create_pdf' value='CreatePDF'/>
  31. </form>";
  32. fetch_data();
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement