KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Download Pdf file from export is damage #319

Open Applicatta opened this topic on on Jun 13, 2018 - 14 comments

Applicatta commented on Jun 13, 2018

Hi, I'm trying to export my report to pdf, i'd set the path to the phantomjs on my server and also set "useLocalTempFolder"=>true, and i can see the document in tmp folder (i can even open it), but when i try to open the download file it's says that it's damaged, and happens the same when i try to open directly in the browser.

I appriciate your help. Regards.

David Winterburn commented on Jun 14, 2018

Hi there,

Did you open the generated tmp pdf file with your browser or your pdf viewer? There's a chance a pdf viewer could view the file while Chrome/Firefox will show error if there're blank lines/spaces at the beginning of the pdf file.

Applicatta commented on Jun 14, 2018

Hello! Today I tried again from 0 successfully. In my previous test I was printing some variables before running the report, so that was ... Thank you very much for the support.

TRAORE commented on Dec 2

I get the same problem. when i want to export my file to pdf in my tmp folder i can open the file but if i use the browser to open i get the error of damaged file pdf. help me please

David Winterburn commented on Dec 3


Would you please upload the pdf file and send us a link to it? Thanks!

TRAORE commented on Dec 3

thank you for the response. my file pdf name is mypage.pdf. you can dowload it https://www.dropbox.com/s/yjpq6zs1c6xo6bl/mypage.pdf?dl=0

KoolReport commented on Dec 3

It is not damage but just that you have not add Bootstrap style to report. Please try to add this on your report:

class MyReport extends \koolreport\KoolReport
    use \koolreport\clients\Bootstrap; // <- This is important

Please let me know if it works.

TRAORE commented on Dec 3

I get the same problem. when i try to open the file with the browser firefox i get the error of the file damaged

David Winterburn commented on Dec 3

Hi Traore,

I downloaded the pdf file from your link and open it on Firefox with no problem. Would you mind posting a screenshot of the error you get? Thanks!

TRAORE commented on Dec 3

Ok , this is the link to my pdf file which genere the error https://www.dropbox.com/s/wav3nth5mm51qnx/Mypage%20copy.pdf?dl=0

TRAORE commented on Dec 3

When i use the export code with saveAs() the file is good, but when i use function toBrowser() the file is damaged

KoolReport commented on Dec 4

I see, this issue is caused by extra character. In your export function, you have somewhere output (like echo) string, character to stream. That will be mixed with the file content output from the toBrowser() function. That's why the file is corrupted.

Please make sure that you don't have any header() function, no output to stream (like echo), no extra character, except for the toBrowser() function of report.

TRAORE commented on Dec 4

i have seeked a echo instruction on my code but i find nothing. this is the link of my code source. i use laravel in my file reportController i have the code of my export.php. the link: https://www.dropbox.com/sh/kh682b4cttap7ih/AAD_iCE38QfTItooGo6sF3ETa?dl=0. Thank you in advance

KoolReport commented on Dec 4

In your MyReport.php, please remove the ?> at the end of file. Let me know if it works.

TRAORE commented on Dec 5

i remove the ?> at the end of my file "MyReport.php" and i get again the same problem of damaged file

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed