KoolReport's Forum

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

CloudExport - pdf report cut a bit from the left #973

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

Eugene commented on Jul 4, 2019

Even the simplest report (just some html tags is cut a bit from the left side like this

I tried to use scale and margin options without any result

report.php

require_once "report.php";

$report = new report();

$report->run()
    ->cloudExport("reportPDF")
    ->chromeHeadlessio("***")
    ->pdf(array(
        "format"=>"A4",
        "scale"=>0.7,
        "margin"=>array(
            "left"=>30
        )

    ))
    ->toBrowser("RD report_" . date('dmyHi').".pdf")

reportPDF.view.php

<div class="row">
    <h1>Recipe Direct</h1>
    <p>List of recipies. Names of items and costs of items are clickable.</p>
</div>

PS Is it possible to keep the backgrounds of cells and fonts colour in exported PDF? printBackground does not help

David Winterburn commented on Jul 5, 2019

Hi Eugene,

For margin, please try to add "px" to the margin left property like this:

    "left"=>"30px"

Increase the margin if you need it. Html printing depends alot on element layout, css so it's not always perfect.

Regarding cells background and font color, please use include the background and font CSS rules in your page. Also try including this CSS rule:

body{
  -webkit-print-color-adjust:exact;
}

Let us know if it works for you or not. Thanks!

Eugene commented on Jul 5, 2019

"left"=>"30px" or 50px - does not help The margin exist and the size of it is different depending on the value but the part of the report is cut.

My html is pretty simple and unfortunately I can not use export package (shell_exec is disabled on my server and i cannot change it) so i have no choice for pdf export - only CloudExport.

What i have to change to get the correct report?

David Winterburn commented on Jul 5, 2019

Hi,

Please post your PDF php view file code. Thanks!

Eugene commented on Jul 5, 2019

I've made it as simple as possible but it is still cut.

<div class="row">
    <h1>Recipe Direct</h1>
    <p>List of recipies. Names of items and costs of items are clickable.</p>
</div>

but like this

<div>
    <h1>Recipe Direct</h1>
    <p>List of recipies. Names of items and costs of items are clickable.</p>
</div>

it works fine... does it mean that it is the bootstrap issue? how to resolve it?

David Winterburn commented on Jul 5, 2019

Hi Eugene,

I think with Bootstrap row class element should be inside container or container-fluid class element. Please try to add an outside div classed container to your row divs and see how it goes for PDF export. Thanks!

Eugene commented on Jul 5, 2019

Yes, you are right. I used my usual report template and forgot that this wrapping div i put in the separate included file... Thank you for your support

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
solved

CloudExport