Code Monkey home page Code Monkey logo

Comments (2)

Behau avatar Behau commented on June 1, 2024 1

Hi maechler,

I found my problem.
Some parts of the content elements had <div> container in it and so the <f:format.htmlentitiesDecode value="{element}" /> part made some problems at the pdf-creation.

This content comes from a form where people can entry information about courses etc. And someone had copied elements from a hompeage and with that, the <div> elements...

I will now write a code, that will cut off this <div> elements and save the light html code in the database.

Thank you for your help it seems that it is now working :)

from pdfviewhelpers.

maechler avatar maechler commented on June 1, 2024

Hi Behau

I just copied part of your template and that worked just fine, also with the ViewHelper f.format.htmlentitiesDecode.

Code

{namespace pdf=Bithost\Pdfviewhelpers\ViewHelpers}

<pdf:document outputDestination="I" title="Report">
    <pdf:page autoPageBreak="1">
        <pdf:html>
            <style>
                table {
                    color: #003300;
                    font-size: 8pt;
                    border: 1px solid black;
                }
                th {
                    font-weight: bold;
                    font-size: 8px;
                    text-align: left;
                    border-bottom: #eee 1px solid;
                    background-color: #eee;
                }
                td {
                    border: none;
                }
            </style>

            <f:for each="{0: 'test', 1: 'M&uuml;ller &amp; Breuer'}" as="element">
                <table class="second" cellpadding="2" cellspacing="5">
                    <tr>
                        <td>{element}</td>
                    </tr>
                    <tr>
                        <th><f:format.htmlentitiesDecode value="{element}" /></th>
                    </tr>
                </table>
            </f:for>
        </pdf:html>
    </pdf:page>
</pdf:document>

output
test_pdf

I think the problem you are describing could be because of a caching issue. When the frontend cache is empty the pdf gets first generated without any problems. However it will not be saved to the frontend cache but an empty entry will be. The second and third time you call the page with caching enabled, you get a blank page.
From pdfviewhelpers version 1.1.0 onward the frontend caching is disabled by default.
What version are you using?
Try clearing the frontend cache and see if the pdf gets generated correctly.

If that is not the problem, please try to give more details on what exactly happens and when. Is there a message in the PHP error logs? What header are you referring to?

You could even send me your extension and I could try it out myself.

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.