KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

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, 2019

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, 2019

Hi TRAORE,

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

TRAORE commented on Dec 3, 2019

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, 2019

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, 2019

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, 2019

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, 2019

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, 2019

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, 2019

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, 2019

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, 2019

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

TRAORE commented on Dec 5, 2019

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

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Export