KoolReport's Forum

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

Export package #152

Open EGROW SOLUTIONS, LLC opened this topic on on Nov 10, 2017 - 26 comments

EGROW SOLUTIONS, LLC commented on Nov 10, 2017

Hello,

Want to use the export package as standalone - want to export an html page to page. Could you please provide an example of how to do this using export package

Kris

KoolReport commented on Nov 10, 2017

Hi,

I suggest you to follow our arctile The Easiest Way to Convert HTML To PDF In PHP.

Also, here are additional guide:

You may add another HTML page that you want to export for example MyAnotherPage.view.php. To export the new page you only need to do:

$page = new MyPage;
$page->run()->export("MyAnotherPage")->pdf(array(
    "format"=>"A4",
    "orientation"=>"portrait"
))->toBrowser("myanotherpage.pdf");

Let me know if you need further assistance.

EGROW SOLUTIONS, LLC commented on Nov 10, 2017

Thank you for the response. Followed the article getting error - Fatal error: Uncaught Exception: Could not save content to temporary folder

Using php 7 under windows

Also, naming file with .view.php - is this necessary?

EGROW SOLUTIONS, LLC commented on Nov 10, 2017

Got it to work, seems like .view is important in naming the file

The file name I used pdf-example.php -- used ->export("pdf-example") -- did not work

changed the file name to pdf-example.view.php and used ->export("pdf-example") -- this works

If is possible to add an option to pass what ever the file name is for example ->export("myfilename.php") or ->export("myfilename.html")

Also, just a suggestion - it would be good to use DIRECTORY_SEPARATOR -instead of slash in saveTempContent in Handler.php since slashes are differently interpreted in windows and linux

Thanks, kris

KoolReport commented on Nov 10, 2017

I see, great that you have made it work :)

And thank for your suggestion, I will tell dev.team about it and keep you update.

Naveen Aggarwal commented on Nov 16, 2017

Tried to use Export package. Getting the error : Could not save content to temporary folder. Index.html file has the following contents

<?php 
    require_once "EmployeeList.php";
    $report = new EmployeeList;
    //$report->run()->render();
  //  $report->run()->exportToExcel()->toBrowser("myreport.xlsx");
    $report->run();//->export()->pdf(array(
    $report->export()->pdf()->toBrowser("sakila.pdf");
    
?>

Any help highly appreciated.

KoolReport commented on Nov 16, 2017

May be your system does not allow php to write on temp folder, please use the alternative:

$report->export()
->settings(array(
    "useLocalTempFolder"=>true,
))
->pdf(array(
    "format"=>"A4",
    "orientation"=>"portrait"
))
->toBrowser("employeelist.pdf");
Naveen Aggarwal commented on Nov 16, 2017

Thanks a lot ! Still getting the following error : Fatal error: Uncaught Exception: Could not save content to temporary folder in F:\apache24\htdocs\mis_latest\koolreport\packages\export\Handler.php:89 Stack trace: #0 F:\apache24\htdocs\mis_latest\koolreport\packages\export\Handler.php(142): koolreport\export\Handler->saveTempContent() #1 F:\apache24\htdocs\mis_latest\Instt.php(14): koolreport\export\Handler->pdf(Array) #2 {main} thrown in F:\apache24\htdocs\mis_latest\koolreport\packages\export\Handler.php on line 89

KoolReport commented on Nov 16, 2017

Could you please give me some information about your php and os

Naveen Aggarwal commented on Nov 16, 2017

php 7.0 on Windows 10 pro.

Naveen Aggarwal commented on Dec 26, 2017

Any solution ?

Oscar Otero commented on Aug 20, 2019

Hello,

I am getting the same error. I tried the alternative solution and nothing. Mine is installed in a Linux web hosting service with PHP 7.3.

KoolReport commented on Aug 21, 2019

Hi Oscar,

Could you please describe your issue in details. It is better to create separate topic so we can answer the issue specifically to your case.

gentlegriffon commented on Dec 25, 2019

I'm following the koolReport example as below:

$report = new SalesByCustomer;
$report->run()
            ->export('TestReportController')
            ->settings(array(
                "useLocalTempFolder"=>true,
            ))
            ->pdf(array(
                "format" => "A4",
                "orientation" => "portrait",
                "zoom"=>2
            ))
            ->toBrowser("TestReportController.pdf");

But still get this error, please help.

David Winterburn commented on Dec 26, 2019

Please post your error message. Thanks!

gentlegriffon commented on Dec 27, 2019

Exception Could not save content to temporary folder http://127.0.0.1:8000/real-estate/test-report/export

This is the error I get

gentlegriffon commented on Dec 29, 2019

@David Winterburn Please assist me on this issue. Thanks

David Winterburn commented on Dec 31, 2019

Hi,

Sorry for the late reply! It is strange that the temporary folder is a http link. Would you please print a screenshot of the error and post it for us to check.Thanks!

gentlegriffon commented on Jan 1, 2020

this is the error I get:

I'd appreciate your help ASAP, I tried everything online but nothing worked.

Thank you

KoolReport commented on Jan 1, 2020

Could you please check if the specified temp folder has write permission.

gentlegriffon commented on Jan 3, 2020

What temp folder will it be exactly? Please clarify more.

Here is the tmp folder found under project/public/tmp, with properties. Is this enough??

Also, in xampp server's php.ini file, I have this:

; Directory where the temporary files should be placed. ; Defaults to the system default (see sys_get_temp_dir) ;sys_temp_dir = "/tmp"

What do I have to do with the permissions to fix it? or is it trying to save in a different location??

KoolReport commented on Jan 3, 2020

If you remove this:

"useLocalTempFolder"=>true,

does it work?

Using the local temp folder, export package will try to create folder koolreport/export/tmp to save generated pdf. However in some case, php does not allow to create folder. So by default, we use system temp folder. So please remove the above settings to use the system temp folder.

gentlegriffon commented on Jan 5, 2020

@koolReport No it doesn't. I tried .. you mean "vendor\koolreport\export\tmp"? I tried also to change its permissions but it didn't work. What are the currect access settings for the tmp folder??

David Winterburn commented on Jan 7, 2020

Hi,

The local tmp folder is created should be created in your current folder which contains the report files. Please check if your report's current folder is writable for your php user. To find out your php user name:

https://stackoverflow.com/questions/12754437/get-windows-username-of-current-user-using-php

gentlegriffon commented on Jan 7, 2020

I tried: <?php echo getenv("username"); ?> <!-- this gave me "Abeer" --> <?php echo getenv("HOMEDRIVE") . getenv("HOMEPATH"); ?> <!-- this gave me "C:\Users\Abeer" -->

Does this seem correct? knowing that I see no "tmp" or "temp" folders under "C:\Users\Abeer"

What does this mean?

David Winterburn commented on Jan 8, 2020

What is the folder structure of your web? I meant the folder where your report files like MyReport.php and MyReport.view.php lie in? Please make sure that its permission is writable for your php user.

gentlegriffon commented on Jan 11, 2020

I'm sorry for the late reply. I have TestReportController.php under ...app\Http\Controllers\RealEstate\TestReportController.php and index.blade.php under ...resources\views\RealEstateSystem\Settings\TestReport\index.blade.php

How do I check for the correct permissions?? Are the settings below correct? what else do I have to do?

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
None yet

None