KoolReport's Forum

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

Line split across page on Dashboard PDF Export #2740

Open Jim Lam opened this topic on on Jun 25, 2022 - 9 comments

Jim Lam commented on Jun 25, 2022

As the subject said, when I tried to use Dashboard PDF export on a Table widget, it is very often that a line or a row of the table will be split across 2 pages.

This looks really unprofessional. Does anyone knows any way or workaround that can avoid this happening?

Thank you Jim

Sebastian Morales commented on Jun 27, 2022

If you use LocalExport engine in your Dashboard's App's export setting, pls add these css rules to your tables:

float:none;
page-break-inside: avoid;
Jim Lam commented on Jun 28, 2022

Hi Sebastian

Thanks for the reply. I am sorry but I am a new guy to using Dashboard.

I am not sure where I can put in the css styles as you mentioned in the Table widget under Dashboard.

Please advise. Thank you

Sebastian Morales commented on Jun 29, 2022

Pls open the file koolreport/dashboard/amazing/widgets/Table.view.php and add those CSS rules to the table element or its div parent element. Not the best solution but let's try it for now. Rgds,

Jim Lam commented on Jun 29, 2022

Thanks for the reply, but it does not work.

I added the two css style in the Table.view.php, and do an inspect to confirm that they are there, as shown below

And the result is still showing split row across page, as seen below.

Before that, I had tried to use an additional css file thru App, by adding

.table { float: none; page-break-inside: avoid; }

And also confirmed thru inspect that the table did have those css property as well.

Please advise. Jim

Sebastian Morales commented on Jun 30, 2022

How many rows are there in your table?

Jim Lam commented on Jun 30, 2022

Range from 20 to 300 or more, depending on the range selected by user. For some selections, that may span to more than 50 pages.

Sebastian Morales commented on Jun 30, 2022

Do you want to print 300 rows in one page?

Jim Lam commented on Jun 30, 2022

No. Not on one page, I just want to make sure that a row will NOT be split between page breaks.

Sebastian Morales commented on Jun 30, 2022

Ok, I see your point. Pls try this global CSS rule

table tr {
  page-break-inside: avoid !important;
}

In case you are using LocalExport engine (which is defined in App.php's export function) pls add this also:

body > * {
  width: 66.667%;
  zoom: .666;
}

If these steps still don't work, you might want to change to using cloud export like this:

    //App.php
    protected function export()
    {
        return ExportHandler::create()
                ->storage(dirname(__DIR__)."/storage")
                ...
                ->pdfEngine(
                    \koolreport\dashboard\export\ChromeHeadlessio::create()
                    ->token($secretToken)
                );
    }

Here's the guide to get cloud export's secret token:

https://www.koolreport.com/docs/cloudexport/chromeheadlessio/

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

Dashboard