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

QuestionsTCPDF ERROR: Some data has already been output, can't send PDF file
JOEL GOMES asked 10 years ago

hi and sorry to bother,
I have this problem when i try to pdf export, and i have to solve it, i have checked all the code and i dont have nothing more before $out = $g->render("list1"); , i will put here some of my code, i really need some help, i have tryed everything…

$g->set_columns($cols);
$opt["add_options"]["success_msg"] = "Added with Success";
$opt["edit_options"]["success_msg"] = "Edited with Success";
$opt["delete_options"]["success_msg"] = "Deleted with Success";
// for bulk editing
$opt["edit_options"]["success_msg_bulk"] = "Updated with Success";
$opt["edit_options"]["checkOnSubmit"] = true;
$opt["footerrow"] = false;
$opt["actionicon"] = true;
$opt["add_options"]["afterSubmit"] = "function(){ window.location.reload(); return [true, ''];}";
$g->set_options($opt);

//$out=$g->render("list1");
$out = $g->render("list1");

3 Answers
Abu Ghufran answered 10 years ago

You can email me complete grid code for review at [email protected]

Samsun answered 10 years ago

Maybe yo must add ob_end_clean(); before $pdf->Output() in jqgrid_dist.php, like this:

ob_end_clean();
$pdf->Output($this->options["export"]["filename"], 'I');

Regards,
Samsun

Abu Ghufran answered 10 years ago

There are usually 2 reasons for this.

1) blank space character at start of file
2) invisible BOM character at start of file

In case #1 will give header already sent error. #2 will push all data as html text.

White spaces can be removed by checking top and end of all included files.
To remove invisible BOM character, i would recommend Notepad++ -> Open file -> Encoding menu -> Encode UTF without BOM

Your Answer

6 + 14 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?