KoolReport's Forum

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

Exporting to PDF is generating blank file #1197

Open Peter Harari opened this topic on on Dec 2 - 5 comments

Peter Harari commented on Dec 2

Hi,

I have recently set up the exporting in my Laravel app with success. It exports to Excel and PDF, both in my local env and in the cloud env as well. Last week only the PDF started to generate a valid PDF file but with a blank page in the cloud env. In my local env is all good.

In the cloud container I executed composer clear-cache followed by composer update. The proccess went fine. Then I checked that vendor/koolreport/export/bin/phantomjs file permissions were -rwx------. I set it to 755 then 777, but neither of them worked.

Here is a sample file of the result I'm getting, if it helps: https://drive.google.com/open?id=1pGbFEZXIp3P03v2zdyHVGGoTW9R3cO24

I don't know where to look at to figure out what is happening, because I don't have an error message/code. Any advice on this ?

Thank you in advance.

KoolReport commented on Dec 2

Most of environment works by just copying phantomjs to bin folder as we suggested. However in some cases, you need to install phantomjs by command line like this topic. And one more thing, since the phantomjs will not install in the bin, in this case you need to specify the path to phantomjs.

Peter Harari commented on Dec 2

Hello,

I got it to work until last week, only by downloading the phantomjs binary to the above mentioned path in the container vm. I must say that what you proposed, if really needed, adds complexity in my environment since I deploy in a cloud service, and I'm trying to concentrate everything on composer(as I explained in this topic). I'm not sure how deep I can go in the container to use apt-get neither if I can use apt-get in composer.

There is no other step before trying what you proposed to debug the problem and fix it the way it was working before?

I mean, the PDF is being generated but blank. There is no way to debug/log that process? To the a phantomjs error or something ?

Thank you.

Peter Harari commented 7 days ago

Hello,

Any news on this ?

Thank you.

KoolReport commented 3 days ago

If you just make a simple view with only some text in it. Do you receive blank page as well?

Peter Harari commented 3 days ago

Hello,

Yes, I do get blank page as well.

I created a test report like:

<?php 

namespace App\Reports;

class TestReport extends BaseReport
{
}

As my BaseReport is:

<?php

namespace App\Reports;

use \koolreport\KoolReport;

class BaseReport extends KoolReport
{
    use \koolreport\export\Exportable;
    use \koolreport\excel\ExcelExportable;
}

And a view:

<?php
    $buildVersion = env(\App\Core\EnvParams::HEROKU_RELEASE_VERSION, null);
?>
<html>
    <head>
        <title>Tyto ERP</title>
    </head>
    <body>
        <h1>Relatório Teste</h1>
        <h3>Versão app: <?php echo $buildVersion; ?></h3>
    </body>
</html>

And called it as:

$report = new \App\Reports\TestReport();

$report
    ->export('TestReport')
    ->pdf(array(
        "format" => 'A4',
        "orientation" => 'portrait'
    ))
    ->toBrowser("TestPdfReport.pdf");

And I still got a blank page. Again, the phantomjs binary is on the correct location:

Thank you.

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

Export