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

Since 2.3.2 the PDF template background is above background and borders of pdf:html #165

Closed
mxpgmbh opened this issue Jun 17, 2020 · 6 comments
Assignees
Labels

Comments

@mxpgmbh
Copy link

mxpgmbh commented Jun 17, 2020

Describe the bug
I use a template PDF with some background image (e.g., some circles) and add text with the pdf:htmlViewHelper to it. In the ViewHelper I draw a table (some data points) and define background and borders with CSS (so the table gets more readable).

Since version 2.3.2 of pdfviewhelpers the PDF background gets drawn over the background and borders of the table. The text iteself is in front of the background.

Here a screenshot, how it looks like with the bug:
with_bug

Here a screenshot how it should look like:
without_bug
Environment

TYPO3 version(s): 9.5.19
pdfviewhelpers version: >= 2.3.2

Steps to reproduce
I can probably provide you with the corresponding PDF and the TypoScript config I use as well as the Fluid Template. I do have to check with our customer first though, if I can give you the data or if I have to annonymize it first.

Expected behavior
PDF is created as before, the template PDF ist under the text written on it

Possible solution
No idea, I downgraded to 2.3.1 for the moment.

@maechler
Copy link
Member

@mxpgmbh Thanks for reporting! That could be related to the FPDI and TCPDF updates done in v2.3.2: https://github.com/bithost-gmbh/pdfviewhelpers/blob/master/CHANGELOG.md#232---june-1-2020

If you could try to downgrade FPDI to v2.2.0 and test it again, that would be great. The source is located in EXT:pdfviewhelpers/Resources/Private/PHP/fpdi/.

FPDI: https://www.setasign.com/products/fpdi/downloads -> older versions

If else you could provide me your template, that would nice as well. You could also send it privately via email: https://www.bithost.ch/unternehmen/

@maechler maechler added the bug label Jun 17, 2020
@mxpgmbh
Copy link
Author

mxpgmbh commented Jun 22, 2020

I sent you an email with an example mini extension demonstrating the bug,

@maechler
Copy link
Member

@mxpgmbh It seems to be related to this change: 027163c

I will have to further investigate this. You could go back to the previous behaviour by providing your own BasePDF class:

plugin.tx_pdfviewhelpers.settings {
        config {
                class = Vendor\YourExtension\Model\MyPDF
        }
}
<?php
namespace Vendor\YourExtension\Model;

class MyPDF extends \Bithost\Pdfviewhelpers\Model\BasePDF
{
    /**
     * @inheritDoc
     */
    public function renderHeader()
    {
        parent::renderHeader();

        $this->setPageMark();
    }
}

It seems however that this does only work for manual page breaks and not for automatic page breaks.

@maechler
Copy link
Member

maechler commented Jun 23, 2020

@mxpgmbh I think I found the correct way to fix this: 9a94a1f

According to the TCPDF documentation setPageMark() needs to be called after an image is placed in the background to allow the content to be rendered in front of the background:

This function must be called after calling Image() function for a background image.

The same seems to apply if we use a PDF template in the background. I will create a new release this week.

@maechler
Copy link
Member

I just released v2.3.4 which fixes this issue. If you like the extension, please consider giving it a star on GitHub :)

@mxpgmbh
Copy link
Author

mxpgmbh commented Aug 14, 2020

Sorry for the late reply, with work and vacation, I was just now be able to test the new version.

It works now as expected, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants