0

this is the link for the dompdf, http://code.google.com/p/dompdf/

it is used to convert html to pdf .

when i tried using it normally(without using plugin), i am not getting error, its working fine . when i am trying to use it inside wordpress plugin, i am getting error that headers already sent , what is the solution for this ? if u want to experiment, try this code

<?php
require_once("dompdf_config.inc.php");

$html =
'<html><body>'.
'<p>Put your html here, or generate it with your favourite '.
'templating system.</p>'.
'</body></html>';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");

?>
  • Search for the error message, on Google or here on SO – Pekka May 31 '12 at 13:31
  • dont u think i searched?? i searched and didnt find the answer.. – user1423849 May 31 '12 at 13:33
  • 1
    When you use this code inside a WP plugin, the problem probably is that WP already output some data before your script is reached. Refer to the line number(s) specified to see what WP does there – Pekka May 31 '12 at 13:36
  • ya, i did that, it said header sent at line number 91 at wp-admin/menu-header.php , i tried commenting the echo present at that line, next it showed another line, i commented it also(i know i shouldnt commnet like that, but just to test), – user1423849 May 31 '12 at 13:42
  • one more thing is , class.pdf.php(part of that dompdf), it has some invalid characters in it, when i am trying to edit , editor showing that it had invalid charcters, do u know how to detect and remove them ? – user1423849 May 31 '12 at 13:44

0 Answers0