Advertisement
Guest User

test html2pdf pour spip

a guest
Sep 13th, 2010
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. // récupération du contenu HTML
  2. $ch = curl_init('http://domain.tld:1081/spip.php?page=fiche_pdf&id_article=50');
  3. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  4. curl_setopt($ch, CURLOPT_PROXY, "http://proxy.domain.tld");
  5. curl_setopt($ch, CURLOPT_PROXYPORT, 8080);
  6. $content = curl_exec($ch);
  7.  
  8. $content = utf8_decode($content);
  9. $content = html_entity_decode($content, ENT_QUOTES);
  10.    
  11. // conversion HTML => PDF
  12. require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php');
  13. try {
  14.         $html2pdf = new HTML2PDF('P','A4','fr', false, 'ISO-8859-15');
  15. //      $html2pdf->setModeDebug();
  16.         $html2pdf->setDefaultFont('Arial');
  17.         $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
  18.         $html2pdf->Output('exemple00.pdf');
  19. }
  20. catch(HTML2PDF_exception $e) { echo $e; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement