Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get rid off this error with TCPDF :"TCPDF ERROR: Some data has already been output to browser, can't send PDF file"
    primarykey
    data
    text
    <p>I want to print the output(i.e. value of variable $matter) but I'm getting the error message mentioned above. I did lot of google for it and checked for spaces before and after php tags. But couldn't get the solution. Please help me. Here is my code to print output using tcpdf: </p> <pre><code>&lt;?php ob_start(); require_once("../../includes/application-header.php"); // Include tcpdf liabrary require_once OCN_ROOT."/core/extention/tcpdf/config/lang/eng.php"; require_once OCN_ROOT."/core/extention/tcpdf/tcpdf.php"; define ('PDF_MARGIN_TOP', 22); define ('PDF_HEADER_TITLE', 'This is Heading'); define ('PDF_HEADER_STRING', $head_string); define ('PDF_CREATOR', PAGE_TITLE); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf-&gt;SetCreator(PDF_CREATOR); $pdf-&gt;SetAuthor(PDF_CREATOR); $pdf-&gt;SetTitle('TCPDF Example'); // set default header data $pdf-&gt;SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf-&gt;setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf-&gt;setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf-&gt;SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf-&gt;SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf-&gt;SetHeaderMargin(PDF_MARGIN_HEADER); $pdf-&gt;SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf-&gt;SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf-&gt;setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf-&gt;setLanguageArray($l); // --------------------------------------------------------- // set font $pdf-&gt;SetFont('helvetica', '', 10); // add a page $pdf-&gt;AddPage(); $matter = &lt;&lt;&lt;EOD &lt;h1&gt;HTML Example&lt;/h1&gt; EOD; $pdf-&gt;writeHTML($matter, true, false, true, false, ''); // reset pointer to the last page $pdf-&gt;lastPage(); // --------------------------------------------------------- ob_flush(); //Close and output PDF document $pdf-&gt;Output('example_061.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload