You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
XLSX content on one page PDF
What is the current behavior?
three pages
What are the steps to reproduce?
//PDF
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class);
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
$inputFileType = 'Xlsx';
$inputFileNames = DIR . '/ajustes_pag/05featuredemo.xlsx';
$inputFileNames = glob($inputFileNames);
foreach ($inputFileNames as $inputFileName) {
$reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
// Save
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class);
$writer = IOFactory::createWriter($spreadsheet, 'Pdf');
////HORIZONTAL SE AJUSTA AL ANCHO DE LA PAGINA, PERO NO AL LARGO(VARIAS PAGINAS)
$writer->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$spreadsheet->getActiveSheet()->getPageSetup()->setFitToHeight(1);
header('Content-Type: application/pdf');
header('Content-Disposition: inline;filename="prueba.pdf"');
header('Cache-Control: max-age=0');
$writer->save('php://output');
$spreadsheet->disconnectWorksheets();
unset($spreadsheet);
exit;
}
What features do you think are causing the issue
Reader
Writer
Styles
Data Validations
Formula Calulations
Charts
AutoFilter
Form Elements
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Which versions of PhpSpreadsheet and PHP are affected?
PHP8.0 and PhpSpreadsheet 1.23
The text was updated successfully, but these errors were encountered:
While investigating, I found several different problems (PR #2788). Unfortunately, none of these match yours.
It looks like you might be trying to copy the xlsx result of samples/Basic/05_Feature_demo to a Pdf via load/save. If that is so, I ran your script with minimal modifications, and got the expected result - a single landscape page with all the data fitted to it. So I am unable to duplicate your symptom. Perhaps you can upload your input and output files.
Hi there, I'm experiencing this issue @oleibman. I've been trying all I can to try and resolve this, including using the other PDF writers, and setting paper size and orientation on both the spreadsheet and the writer, but having no success. I cannot share my document publicly due to sensitive content, what's the best approach to share so we can try to debug this issue?
I'm focusing most of my energy on this problem with Dompdf as its so far produced the best PDF result, just cutting off the right of a sheet, and also pushing rows down into the 2nd sheet.
This is:
What is the expected behavior?
XLSX content on one page PDF
What is the current behavior?
three pages
What are the steps to reproduce?
//PDF
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class);
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
$inputFileType = 'Xlsx';
$inputFileNames = DIR . '/ajustes_pag/05featuredemo.xlsx';
$inputFileNames = glob($inputFileNames);
foreach ($inputFileNames as $inputFileName) {
$reader = IOFactory::createReader($inputFileType);
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($inputFileName);
// Save
IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class);
$writer = IOFactory::createWriter($spreadsheet, 'Pdf');
////HORIZONTAL SE AJUSTA AL ANCHO DE LA PAGINA, PERO NO AL LARGO(VARIAS PAGINAS)
$writer->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
$spreadsheet->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$spreadsheet->getActiveSheet()->getPageSetup()->setFitToHeight(1);
header('Content-Type: application/pdf');
header('Content-Disposition: inline;filename="prueba.pdf"');
header('Cache-Control: max-age=0');
$writer->save('php://output');
$spreadsheet->disconnectWorksheets();
unset($spreadsheet);
exit;
}
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Which versions of PhpSpreadsheet and PHP are affected?
PHP8.0 and PhpSpreadsheet 1.23
The text was updated successfully, but these errors were encountered: