Tcpdf Error: Some Data Has Already Been Output, Can't Send PDF File

How do I reset or revert a file to a specific revision?

Assuming the hash of the commit you want is c5f567:

git checkout c5f567 -- file1/to/restore file2/to/restore

The git checkout man page gives more information.

If you want to revert to the commit before c5f567, append ~1 (where 1 is the number of commits you want to go back, it can be anything):

git checkout c5f567~1 -- file1/to/restore file2/to/restore

As a side note, I've always been uncomfortable with this command because it's used for both ordinary things (changing between branches) and unusual, destructive things (discarding changes in the working directory).


There is also a new git restore command that is specifically designed for restoring working copy files that have been modified. If your git is new enough you can use this command, but the documentation comes with a warning:

THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

TCPDF ERROR: Some data has already been output to browser, can't send PDF file

Your "Notice: bla bla" errors are the one causing you trouble, as they're output. Indeed they're not errors just warnings that can be ignored.

Disable PHP Notice errors with:

error_reporting(E_ALL & ~E_NOTICE);

at the start of your PHP (before your require() or include() of html2pdf module).

Some data has already been output, can't send PDF file

put if isset on your code. ie

if(isset($_POST['submitpdf']))
{
//$id=$_POST['id'];
//your code goes here
}

this is to ensure that your code would only run after reading your form-data

EDIT:

your new error i guess comes from the select string.

$pdf->Table('select leave_id, fullname, type_of_leave from application where     id_no="$_POST[id]"',$prop);

change it to this:

$pdf->Table("select leave_id, fullname, type_of_leave from application where id_no=".$_POST[id],$prop);

Getting TCPDF:Some data has already been output, can't send PDF file in Laravel 4

Probably something has already been written to the output buffer prior to streaming the pdf content.

Try to use ob_end_clean() to clean the output buffer just before the method invocation:

require_once(app_path().'/libs/html2pdf/html2pdf.class.php') ;
$html2pdf = new HTML2PDF('P','A4','en',true,'UTF-8',array(0, 0, 0, 0));
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->WriteHTML($html22);

ob_end_clean();

$html2pdf->Output($username.'_questionnaire.pdf');


Related Topics



Leave a reply



Submit