Advertisement
Guest User

Untitled

a guest
Apr 26th, 2013
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('dompdf/dompdf_config.inc.php');
  4.  
  5. $html = <<<EOD
  6.  
  7. <!doctype html>
  8. <html>
  9. <head>
  10.     <meta charset="UTF-8">
  11.     <title>Document</title>
  12.  
  13.     <style>
  14.     html, body { margin: 0; padding: 0; width: 490px; height: 490px; }
  15.     .base { width: 490px; height: 490px; background-color: #FFBB33; }
  16.     </style>
  17. </head>
  18. <body>
  19.  
  20.     <div class="base">
  21.         Hello
  22.     </div>
  23.  
  24. </body>
  25. </html>
  26.  
  27. EOD;
  28.  
  29. CPDF_Adapter::$PAPER_SIZES['my_square_page'] = array(0, 0, 566.929134, 566.929134);
  30. def("DOMPDF_DPI", 150);
  31.  
  32. $dompdf = new DOMPDF();
  33. // $dompdf->load_html(file_get_contents('content.html'));
  34. $dompdf->load_html($html);
  35. $dompdf->set_paper('my_square_page','portrait');
  36. $dompdf->render();
  37.  
  38. $pdf = $dompdf->output();
  39. file_put_contents('salida.pdf', $pdf);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement