KoolReport's Forum

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

Bootstrap inside exportable report #2263

Open Ron opened this topic on on Aug 15, 2021 - 4 comments

Ron commented on Aug 15, 2021

I have a report that is displayed in the web using BotstrapCss and Font Awsome. When displayed on the web all the classes of Botstrap are displayed but when I export it to PDF locally not using cloudexport I am not getting any response from the classes

Ardan Peddell commented on Aug 16, 2021

Hi Ron, could this be a similar issue to the ticket I posted last night - #2262?

Sebastian Morales commented on Aug 16, 2021

Pls define "not getting any response from the classes" specifically. Which type of web server do you use, Apache, Nginx, etc or PHP built-in server?

Ron commented on Aug 16, 2021

I am using Apache. For example botstrap class name text-danger which makes the text in color red when I render the report inside my chrome I see the result BYT wen the same report is exported as PDF it is not shown. you can see the pdf_view code below:

<?php
//MyReport.view.php
use \koolreport\widgets\koolphp\Table;
?>
<html>
<head>
    <title><?php echo lang('tts.report_teacher_hours_utilized'); ?></title>
</head>
<body DIR="RTL" style="margin: 25px 15px 25px 15px;" class="bg-transparent">
    <div class='page-header' style='width: 100%; height:30px'>
        <img style="float: right;" src="<?php echo site_url('../assets/img/'.(isset($_SESSION['institute_number']) ? $_SESSION['institute_number'].'.png' : "logo.svg")); ?>" height="38" />
    </div>
    <div class="responsive">
    <?php
        echo '<h1 class="text-center pb-1">'. lang('tts.report_teacher_hours_utilized').'</h1>';
        Table::create(array(
            "dataSource"=>$this->dataStore("st"),
            "cssClass"=>array(
                "table"=>"table-bordered text-center",
                "th"=>"table-dark text-center",
                'td'=>function($row,$colName)
                {
                    //return $colName == 'teacher_id' ? 'text-right' : 'text-center';
                    switch ($colName) {
                        case 'teacher_id':
                            return 'text-right';
                            break;
                        case 'total_hours':
                            return ($row["total_hours"] < $row["utilized"]) ? "text-center bg-danger" : "";
                            break;
                        case 'utilized':
                            return ($row["total_hours"] > $row["utilized"]) ? "bg-warning" : "";
                            break;
                        default:
                            break;
                        }
                },
            ),
            "sorting"=>array(
                "teacher_id"=>"asc",
            ),
            "columns"=>[
                "teacher_id",
                "total_hours"=>[
                    "formatValue"=>function($value,$row) {
                        return ($row["total_hours"]<$row["utilized"]) ? "$value <i class='fas fa-exclamation-triangle'></i>" : $value;
                    }
                ],
                "sheet_hours",
                "utilized"=>[
                    "formatValue"=>function($value,$row) {
                        return ($row["total_hours"]>$row["utilized"]) ? "$value <i class='fas fa-exclamation-triangle'></i>" : $value;
                    }
                ],
                "reward_hours",
                "non_schedulable"
            ]
        ));
    ?>
    <div class='page-footer' style='height:20px; width: 100%'>
        <div class="footer" style="width:50%; float: left;"><?php echo lang('tts.print_footer'); ?></div>
        <span style="float: right;"><?php echo lang('tts.page'); ?> {pageNum}/{numPages}</span>
    </div>
</body>
</html>

Sebastian Morales commented on Aug 16, 2021

Hi, pls try this approach:

$report-run()->export("MyReportPDF")

->settings([
    'useLocalTempFolder' => true
])
->pdf(...)

Then look for a .tmp file in the tmp subdirectory in your report directory and open it as a text file. Look for the link tag with src path to bootstrap.css or bootstrap.min.css. Try to open/curl that path on your server and see if it works. Let us know the result. Tks,

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