KoolReport's Forum

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

Cloud Export landscape not working #3266

Open Adolfo Alonso opened this topic on on Mar 16 - 3 comments

Adolfo Alonso commented on Mar 16

Hello, IM now using cloud export to generate PDF files, the problem I have is that my PDF keeps geting portrait mode when I have landscape enabled.

index.php

<?php
require_once "MyReport.php";
$mes = isset($_GET['fecha']) ? $_GET['fecha'] : date('M Y');
$mes = date("M Y",strtotime($mes)); 
$settings = array(
	'useLocalTempFolder' => true,
	'pageWaiting' => 'networkidle2', //load, domcontentloaded, networkidle0, networkidle2
	'autoDeleteLocalTempFile' => false,
);
$pdfOptions = array(
	'format'=>"A4",
	'landscape'=>true,
	'noRepeatTableFooter' => true,
	'scale' => 0.83,
	'printBackground' => false,
	'margin' => [
		 'top'    => '50px',
		 'bottom' => '50px',
		 'right'  => '20px',
		 'left'   => '20px'
	 ],
);
	
$report = new MyReport;
$report->run();
$report->cloudExport("MyReport")
->chromeHeadlessio("XXX")
->settings($settings)
->pdf($pdfOptions)
->toBrowser("Reporte RAV LINDE " . $mes . ".pdf");

Thanks

Sebastian Morales commented on Mar 20

Pls try this pdf option to export a simple PDF view such as a view with only "Hello world" string to see if it outputs in landscape mode.

If it does but your report PDF view does not there could be some css rules in your view that prevent the page from printing in landscape. You could try to remove those rules half by half to see which specific one affects landscape printing.

Adolfo Alonso commented on Mar 20

Hello, I removed everything and still not working.

Index.php

<?php
require_once "MyReport.php";
$mes = isset($_GET['fecha']) ? $_GET['fecha'] : date('M Y');
$mes = date("M Y",strtotime($mes)); 
$settings = array(
	'useLocalTempFolder' => false,
	'pageWaiting' => 'load', //load, domcontentloaded, networkidle0, networkidle2
	'autoDeleteLocalTempFile' => true,
);
$pdfOptions = array(
	'format'=>'A4',
	'landscape'=> true,
	'noRepeatTableFooter' => true,
	'scale' => 0.83,
	'printBackground' => false,
	'margin' => array(
		 'top'    => '50px',
		 'bottom' => '50px',
		 'right'  => '20px',
		 'left'   => '20px'
	 ),
);
	
$report = new MyReport;
$report->run();
$report->cloudExport("MyReport")
->chromeHeadlessio("XXX")
->settings($settings)
->pdf($pdfOptions)
->toBrowser("Reporte RAV " . $mes . ".pdf");

MyReport.php

<head>
	<title>Reporte RAV</title>
</head>

<body>
Hello World
</body>

Thanks

Sebastian Morales commented on Mar 20

Would you pls try our cloud export example here:

http://localhost/KoolReport/GitHub-examples_online/reports/cloudexport/footer_header/

Then change 'landscape'=>false to 'landscape'=>true in file export.php and click Cloud PDF button to see how its PDF result is.

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