WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have used dompdf to display the user information in admin of my wordpress project. While generating the PDF file it works perfectly in my local server. But in live server Unable to stream pdf: headers already sent message is displayed.

The page where pdf is generated is http://mysite.com/wp-admin/admin.php?page=certificate&id=4.

The file for this link is include(ABSPATH."wp-content/themes/ncc/certificate.php");

Here is the code I have used

<style type="text/css">
.fnt_italic { 
    font-size: 18px;
    font-style: italic;
    font-family:Arial, Helvetica, sans-serif;
.clsTd {
    font-size: 12px;
    /*font-family:"Courier New", Courier, monospace!important;*/
.clsBg {
.clsBgGray {
.clsBgWhite {
.clsBold {
    font-weight: bold;
.tbl { border:1px double #000000; }
.notes { font-size:10px; color:#999999; }
.clsDiv { padding-top: 20px; }
<div class="clsDiv">
<table align="center" cellpadding="6" cellspacing="2" width="90%" class="tbl">
      <table border="0" cellpadding="6" cellspacing="2" width="90%" align="center">
          <tr align="center">
            <td class="fnt_italic" colspan="2">Certificate</td>
          <tr align="center">
            <td colspan="2">Name</td>
          <tr align="center">
            <td colspan="2" class="clsTd">Email id</td>
<script type="text/php">
if ( isset($pdf) ) {

  $font = Font_Metrics::get_font("helvetica");
  $size = 9;
  $text_height = Font_Metrics::get_font_height($font, $size);

  $foot = $pdf->open_object();
  $w = $pdf->get_width();
  $h = $pdf->get_height();
  $y = $h - $text_height - 40;
  $pdf->add_object($foot, "all");
  $color = array(0,0,255);
  $text2 = "Page: {PAGE_NUM} of {PAGE_COUNT}";
  $pdf->page_text(710, $y, $text2, $font, $size, $color);
  $text = "Text"; 
  $pdf->page_text(15, $y, $text, $font, $size, $color);
$data = ob_get_clean();
$old_limit = ini_set("memory_limit", "64M");
$dompdf = new DOMPDF();
$size = array(0,0,800.00,700.00);

Can anyone help me what is the creating problem here. Thanks in advance

share|improve this question

closed as off topic by toscho Jul 5 '12 at 21:15

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Do you by any chance have WP_DEBUG turned on there? When you can get a code to work on one server, but then get headers already sent errors on another, its most often a case of debug or error messages being output before the page renders. See if turning debug or error reporting off will allow the page to render properly? – goldenapples Jun 2 '11 at 6:20
Thanks goldenapples :). I checked WP_DEBUG its set to false. Can you suggest me where do I check error reporting ? Is that in server configuration or else where? Thanks again... – user478 Jun 2 '11 at 6:46
This question doesn't necessarily pertain to WordPress even though it sits on a WP install. – Brian Fegter Feb 24 '12 at 3:25