Coder Social home page Coder Social logo

Comments (16)

macjohnny avatar macjohnny commented on May 29, 2024

hey
do you have any other extension on that page which is rendered afterwards?
or do you have any script that will modify the header information during the rendering process?

from pdfviewhelpers.

tombuku avatar tombuku commented on May 29, 2024

I don't think so :-)
I've also deactivated all extensions, but the Warning still appears.
Can something in TS setup config also cause the problem?
My understanding of the whole page processing is not that deep...

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

Does this also happen with our example? https://docs.typo3.org/typo3cms/extensions/pdfviewhelpers/Example/Index.html

You could try creating a new page template and adding only the following configuration:

page = PAGE
page {
        10 = FLUIDTEMPLATE
        10 {
                file = EXT:pdfviewhelpers/Resources/Public/Example/Bithost.html
        }
}

plugin.tx_pdfviewhelpers.settings {
        config {
                class = Bithost\Pdfviewhelpers\Model\BithostTCPDF
                language = eng
        }
        document {
                title = Bithost document
                subject = Autogenerated PDF, By Bithost GmbH
                author = Bithost GmbH
                keywords = Example, Test, Just to show how it works
                creator = TYPO3 pdfviewhelpers
                outputPath = bithost_example.pdf
        }
}

Note you also have to add the static TypoScript template of the extension.

from pdfviewhelpers.

macjohnny avatar macjohnny commented on May 29, 2024

@maechler how about just calling exit() to avoid any processing after the pdf has been generated? this way, would avoid any potential problems...

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

@macjohnny I am still not in favour of such a solution. I think we should let TYPO3 finish gracefully if possible, not doing so could lead to other errors. In addition it would only solve the problem for plugin content that is rendered after the extension pdfviewhelpers, if there is any output before the rendering of the PDF we would have the same problem.
By simply exiting we might also hide possible errors and misconfigurations, because there should not be any other plugin generating output or modifying the headers. I think it is better to fail in such a case.

from pdfviewhelpers.

tombuku avatar tombuku commented on May 29, 2024

I can do some more research and try also your default Example.

How about a ob_clean() right before the PDF Output?
I have done some costum TYPO3 Extensions with FPDF in the past and this was always my last solution to get rid of the header already sent problem. May not a good solution, but the only one a came across so far.

And by the way I was happy to find your solution to integrate TCPDF in TYPO3 Extbase/Fluid in a very easy and solid way...

from pdfviewhelpers.

macjohnny avatar macjohnny commented on May 29, 2024

sounds like a reasonable solution. @maechler what do you think?

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

I guess that is something we could add that is not too harmful. But still it might hide possible errors, errors like we might have one here.

Anyways..having a closer look at the error message it seems like a ViewHelper is producing this error, because it says output started at https://github.com/bithost-gmbh/pdfviewhelpers/blob/master/Classes/ViewHelpers/DocumentViewHelper.php#L106. That is the place where all child ViewHelpers of the document are rendered. One of the ViewHelpers might be echoing something it should not.

What does your fluid template look like?

from pdfviewhelpers.

tombuku avatar tombuku commented on May 29, 2024

The Fluid Template:

<pdf:document outputDestination="I" title="{job.title}">
    <pdf:page>
        <pdf:text>{job.lead}</pdf:text>
        <pdf:headline>{job.title}</pdf:headline>
        <pdf:html>{job.description -> f:format.html()}</pdf:html>

        <pdf:headline padding="{top: 2, right:0, bottom:0, left:0}" fontSize="10">Anforderungen</pdf:headline>
        <pdf:text>{job.requirement}</pdf:text>

        <pdf:headline padding="{top: 2, right:0, bottom:0, left:0}" fontSize="10">Beginn</pdf:headline>
        <pdf:text>{job.start}</pdf:text>

        <pdf:headline padding="{top: 2, right:0, bottom:0, left:0}" fontSize="10">Arbeitsort</pdf:headline>
        <pdf:text>{job.workingPlace}</pdf:text>

        <pdf:headline padding="{top: 2, right:0, bottom:0, left:0}" fontSize="10">Art der Stelle</pdf:headline>
        <pdf:text>{job.employmentType.name}</pdf:text>

        <pdf:headline padding="{top: 2, right:0, bottom:0, left:0}" fontSize="10">Kontakt</pdf:headline>
        <pdf:text>{job.contact}</pdf:text>

        <pdf:text padding="{top: 4, right:0, bottom:0, left:0}">Sollten Sie sich für die ausgeschriebene Stelle interessieren, so bitten wir Sie, uns Ihre vollständigen Bewerbungsunterlagen online oder per Post zukommen zu lassen: PHS AG, Personalberatung, Buckhauserstrasse 36, 8048 Zürich.</pdf:text>
    </pdf:page>
</pdf:document>

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

Hm..I do not see something that should cause that error. Is it possible that you are echoing something in one of the getters of your job entity?
When you use e.g. {job.title} Fluid calls $job->getTitle() which might echo something.

If that is not the case please try it with the example I provided above, just to check if the same error occurs. To find the error it might also help to reduce your template to:

<pdf:document outputDestination="I" title="{job.title}">
    <pdf:page>

    </pdf:page>
</pdf:document>

And then add one line after the other and check if the error occurs.

from pdfviewhelpers.

tombuku avatar tombuku commented on May 29, 2024

I tried your proposal checking the template step by step. I also disabled the header/footer in use. But the PHP Warning is still there.
I am using the Version 1.1.0 and the Line 106 in the DocumentViewHelper with the error is at: ob_end_flush();

Meanwhile I think the problem may apperas as we call it from a action in our Job Extension...

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

Ah okay, I thought you were on version 1.2.0. I have not tested it from an action lately, I will have to do so. It might be possible that this needs some special treatment in order to keep Extbase from sending headers, your suggestion of using ob_clean() might then become a necessary feature.
If you find out something more, please let me know.

btw..
[v1.2.0_commercial]
There is v1.2.0 available with a neat new feature. It is now possible to load a pdf document as template and only fill the blank space in the Fluid template: https://docs.typo3.org/typo3cms/extensions/pdfviewhelpers/TemplatePDF/Index.html
[/v1.2.0_commercial]

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

I am afraid, also from an action I can not reproduce that error.

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

@tombuku Any updates on that issue? Have you found something?

from pdfviewhelpers.

tombuku avatar tombuku commented on May 29, 2024

I gave it up for the moment. I also tried a ob_clean() in your extension, but with no effect. So I am guessing it is a Extbase issue/ or a problem of our extenison...
You can close the ticket. But thanks for your fast support!

from pdfviewhelpers.

maechler avatar maechler commented on May 29, 2024

Alright, thanks for your response!

from pdfviewhelpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.