KoolReport's Forum

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

Export using Laravel and Azure Web Apps #431

Open Brandon Showers opened this topic on on Aug 24, 2018 - 4 comments

Brandon Showers commented on Aug 24, 2018

Hello, I've been struggling to get a working example of simply using exporter for basic html to pdf. I've managed to get past several of the hangups but now i'm stuck with an error: Could not save content to temporary folder.

  1. Can you help me figure out how to get past this error?
  2. Can you post a full working example of using Laravel and export for just basic html to pdf? (no reports)

Here are some code snippits:

//ReportsController.php <?php

namespace App\Http\Controllers;

use \App\Reports\MyReport;

class ReportsController extends Controller {

public function __contruct()
{
    $this->middleware("guest");
}
public function index()
{
    $myreport = new MyReport;
    $myreport->export("App/Reports/MyReport.view.php")->settings(array("useLocalTempFolder"=>true,))->pdf(array("format"=>"A4","orientation"=>"portrait"))->toBrowser("MyReport.pdf");  
}

}

//MyReport.php <?php namespace App\Reports;

//require "../koolreport/autoload.php";

class MyReport extends \koolreport\KoolReport {

use \koolreport\export\Exportable;

}

//MyReport.view.php <!DOCTYPE html> <html>

<head>
    <title>Content that you want to convert to PDF</title>
    <meta charset="utf-8"/>
</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>

    <!-- Javascript embedded -->
    <script type="text/javascript">
        document.getElementById("extra").innerHTML = "Javascript is working";
    </script>
<body>

</html>

I was able to run a standard KoolReport example report, so I know that KoolReport is working in my Laravel env. I am using the laravel package as well.

Also this is a Windows based Azure Web App...

Thanks, Brandon

Brandon Showers commented on Aug 26, 2018

well i've been able to get past several little hang ups and at this point i know it's writing the tmp file containing the html to my ..\export\tmp folder and everything is being passed to phantomjs.exe. But that process runs for several minutes and eventually times out. Any suggestions?

Brandon Showers commented on Aug 26, 2018

found the answer. Azure Web Apps doesn't support gdi+ which is required for PhantomJS to execute properly. At this time Export does not support Azure Web Apps, Functions or Web Jobs...

https://feedback.azure.com/forums/169385-web-apps/suggestions/12864567-support-for-gdi

KoolReport commented on Aug 27, 2018

Thank you for your sharing, it is very valuable. We did not have chance to test on Window Azure Web Apps. We plan to move to Chrome Headless to replace PhantomJs ( although we still keep PhantomJS as an option) in the future and I hope that it will be able to support it.

oliver commented on Aug 3, 2019

For Laravel I would recommend you to go with Cloudways Laravel hosting (https://www.cloudways.com/en/laravel-hosting.php ) platform. This platform is optimized for running Laravel based applications this is why there won't be any issue with running Laravel on their server.

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