Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCPDF - PDF generation does not respect $isPDF #1163

Closed
1 of 3 tasks
Collie-IT opened this issue Sep 21, 2019 · 5 comments
Closed
1 of 3 tasks

TCPDF - PDF generation does not respect $isPDF #1163

Collie-IT opened this issue Sep 21, 2019 · 5 comments

Comments

@Collie-IT
Copy link
Contributor

Collie-IT commented Sep 21, 2019

This is:

What is the expected behavior?

If I use TCPDF as writer, the $isPDF in /vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php should interpreted as true.

What is the current behavior?

If I use TCPDF as writer, the $isPDF is misinterpreted in/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php as false.

What are the steps to reproduce?

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

// add code that show the issue here...
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue("A1" , "Test");
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Tcpdf');
$writer->setEmbedImages(true) ;
$writer->generateHTMLHeader() ;
$writer->generateStyles(true) ;
$writer->generateHTMLFooter() ;
$writer->save($path2); 

Which versions of PhpSpreadsheet and PHP are affected?

Tested with 1.8.2, 1.9.0.

@Collie-IT
Copy link
Contributor Author

The dirty hot fix is set to $isPDF to public in html.php.

@Collie-IT Collie-IT changed the title TCPDF - PDF generation don't respect $isPDF TCPDF - PDF generation does not respect $isPDF Sep 21, 2019
@PowerKiKi
Copy link
Member

What is the consequences of having this flag to the wrong flag? Why do you think it needs to be changed?

@Collie-IT
Copy link
Contributor Author

The Problem is that the pagebreaks will be doubled, if $isPDF is false, because <path>vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Html.php on Line 828 checks for if not PDF

if (!$this->isPdf) {
$css['table']['page-break-after'] = 'always';
}

@stale
Copy link

stale bot commented Nov 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Nov 20, 2019
@stale stale bot closed this as completed Nov 27, 2019
@oleibman
Copy link
Collaborator

oleibman commented Jul 3, 2024

Setting isPdf was added to PDF constructor by PR #1464 in May 2020.

@oleibman oleibman removed the stale label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants