KoolReport's Forum

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

Error when Exporting - Could not save content to temporary folder #1304

Closed Frank DiGiandomenico opened this topic on on Feb 17, 2020 - 5 comments

Frank DiGiandomenico commented on Feb 17, 2020

I'm getting an error when attempting to export. Here's the error I'm getting:

Fatal error: Uncaught Exception: Could not save content to temporary folder in C:\Users\Frank\Documents\phptest\koolreport\export\Handler.php:131 Stack trace: #0 C:\Users\Frank\Documents\phptest\koolreport\export\Handler.php(238): koolreport\export\Handler->saveTempContent() #1 C:\Users\Frank\Documents\phptest\reports\approval-memo\index.php(10): koolreport\export\Handler->pdf(Array) #2 {main} thrown in C:\Users\Frank\Documents\phptest\koolreport\export\Handler.php on line 131

I'm on Windows 10 running WAMP with PHP 7.

And here's my code:

approval-memo.php

<?php
require "../../koolreport/core/autoload.php";

class ApprovalMemo extends \koolreport\KoolReport
{
    use \koolreport\export\Exportable;
}
?>

approval-memo.view.php

<html>
    <head>
        <title>Content that you want to convert to PDF</title>
    </head>
    <body>
        <!-- CSS Style -->
        <style>
            p {font-size:20px;}
            h1 {color:red}
        </style>

        <!-- Normal HTML content -->
        <h1>Export HTML to PDF</h1>
        <p>It is easy to convert HTML to PDF using KoolReport's Export package</p>
        <p id="extra"></p>
    <body>
</html>

index.php

<?php
require "approval-memo.php";

$pdf = new ApprovalMemo;
$pdf->export()
    ->settings(array(
        "useLocalTempFolder"=>true,
    ))
    ->pdf(array(
        "format"=>"A4",
        "orientation"=>"portrait"
    ))->toBrowser("approval-memo.pdf");

I've also tried removing the "useLocalTempFolder" property, but I get the same error message. I can see the .tmp files being created, but they're empty and no content is ever written to them. I've given the necessary user full permissions on the directory where the tmp files are being placed, but still have the issue. Any ideas what may be wrong?

KoolReport commented on Feb 17, 2020

Please change the name like this:

  1. "approval-meno.php" => "ApprovalMemo.php"
  2. "approval-meno.view.php" => "ApprovalMemo.view.php".
Frank DiGiandomenico commented on Feb 17, 2020

Thank you! That fixed the original issue, but now I have another error:

Fatal error: Uncaught Exception: Could not find phantomjs executed file in bin folder in C:\inetpub\wwwroot\LegalBillingAPI\koolreport\export\Handler.php:58 Stack trace: #0 C:\inetpub\wwwroot\LegalBillingAPI\koolreport\export\Handler.php(243): koolreport\export\Handler->runPhantom('C:\\inetpub\\wwwr...', 'C:\\inetpub\\wwwr...', 'C:\\inetpub\\wwwr...', 'eyJmb3JtYXQiOiJ...') #1 C:\inetpub\wwwroot\LegalBillingAPI\reports\approval-memo\index.php(10): koolreport\export\Handler->pdf(Array) #2 {main} thrown in C:\inetpub\wwwroot\LegalBillingAPI\koolreport\export\Handler.php on line 58
KoolReport commented on Feb 17, 2020

Hi, please download phantomjs here and put into koolreport\export\bin. If there is no bin folder, create one. Make sure that the phantomjs.exe has permission to run. Let us know if it works.

Frank DiGiandomenico commented on Feb 17, 2020

That worked! Thank you!

KoolReport commented on Feb 17, 2020

Awesome!

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