Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
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.
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
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.
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
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.
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??
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.
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
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?
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?
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo