KoolReport's Forum

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

Cloud pdf report... the output is so different from the render page #1009

Closed Eugene opened this topic on on Jul 24, 2019 - 6 comments

Eugene commented on Jul 24, 2019

Hi,,, today is my day of exporting... :-)

I try to export my report in PDF via Cloud package but the result looks terrible

I use the same view file but this is render result:

And this is pdf:

pdf_export.php (the file which is open by main report)

require_once "../../koolreport/core/autoload.php";

require_once "stock_list_export.php";


$report = new stock_list_export;
$report->run()
    ->cloudExport("stock_list_export")
    ->chromeHeadlessio("token....")
    ->pdf()
    ->toBrowser("Stock_Inventory.pdf");

The stock_list_export.view.php

<?php

use koolreport\widgets\koolphp\Table;

$InventoryDate = $this->dataStore("stock_fact_names")->data()[0]['date'];
$stock = $this->dataStore("stock_fact_names")->data()[0]['stock'];
//$InventoryDate='';
//$stock='';
?>
<html lang="en">
<head>
    <link rel="stylesheet" href="../../koolreport/bootstrap3/assets/core/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="../../koolreport/bootstrap3/assets/core/css/bootstrap-theme.min.css"/>
    <meta charset="UTF-8">
    <title>Inventory Stock Report</title>
</head>
<body>
<div class="container box-container">
    <div class="text-center">
        <h2>Inventory Stock Report</h2>
    </div>
    <hr/>
    <hr/>
    <div>
        <b>Stock: </b> <?= $stock; ?><br><br>
        <b>Inventory Date: </b> <?= $InventoryDate; ?><br>
    </div>
    <?php
    Table::create(array(
        "dataStore" => $this->dataStore('stock_fact_names'),

        "grouping" => array(
            "catName" => array(
                "top" => "<td colspan=\"2\" <td class='top_group'><b>{catName} </b></td>",
            )),
        "columns" => array(
            "id" => array(
                "label" => "id",
                "type" => "string",
            ),
            "name" => array(
                "label" => "Item Name",
            ),
            "quantity" => array(
                "label" => "Quantity",
                "type" => "string",
            ),
            "uom" => array(
                "label" => "",
            ),
        ),

        "cssClass" => array(
            "table" => "table table-bordered table-striped"
        )
    ));
    ?>
</div>
</body>
</html>

KoolReport commented on Jul 24, 2019

Please try to use absolute path in the css link or you try to use the use \koolreport\bootstrap3\Theme; in your report instead of including in the view like this.

Eugene commented on Jul 24, 2019

I added use \koolreport\bootstrap3\Theme; to my stock_list_export class but no success.... the pdf looks the same

Eugene commented on Jul 24, 2019

The absolute links helped. Thank you

Eugene commented on Jul 24, 2019

But i also cannot add footer and header... i do this

$report->run()
    ->cloudExport("stock_list_export")
    ->chromeHeadlessio("----")
    ->pdf(
        [
        "scale"=>1,
        "format"=>"A4",
       "landscape"=>false,
        "displayHeaderFooter"=>true,
        "headerTemplate"=> '<div id="header-template"
                style="font-size:10px !important; color:#808080; padding-left:10px">
                <span class="date"></span>
                <span class="title"></span>
            </div>',
        "footerTemplate"=> '<div id="footer-template"
                style="font-size:10px !important; color:#808080; padding-left:10px">
                <span class="pageNumber"></span>
                <span class="totalPages"></span>
            </div>'
    ]
    )
    ->toBrowser("Stock_Inventory.pdf");

but get no header and footer

KoolReport commented on Jul 24, 2019

Please set margin as well, set it big enough to see the header and footer

Eugene commented on Jul 24, 2019

Ufff.... You should update the manual ... :-)) thank you

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

None