I have a table with many fields in it. On the grid, I use the select command to show only a few fields. But when I export to PDF, it is throwing the following exception: "TCPDF ERROR: Some data has already been output, can't send PDF file". I'm guessing that the error is because the PDF export is trying to include all the fields from the table, instead of just the ones I'm displaying.
Can you please provide information on how to resolve this?
This error usually come when some html or text is sent to output before the $grid->render() function call. Please recheck.
I've doubled check and there is nothing being sent to output before the render.
This error appears to occur when I filter 823 rows down to 4 rows and use the following:
$grid["export"] = array("format"=>"pdf", "filename"=>"merchant-income-report", "sheetname"=>"test");
$grid["export"] = array("filename"=>"merchant-income-report", "heading"=>"Merchant Income Report", "orientation"=>"landscape", "paper"=>"a4");
$grid["export"]["range"] = "filtered";
Can you check the response of HTTP call using firefox->firebug->response.
If your code is online somewhere, let me know the link.
I had same issue "TCPDF ERROR: Some data has already been output, can't send PDF file". I have used custom export method. In custom export method, at the end method i have added ob_clean(), it solved the problem. Generally this error will appears when something is outputted before the pdf output, it may be space or some special chars.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?