1
votes

I'm using Primefaces 5.3 in a web app along with the Primefaces <p:editor> which saves its data to a database table. I would like to export/print to PDF the value data from the database with the format being ready instead of printing out codes like

<br> or <ul> <li>, etc.

I'm using Jasper reports to create the report and then exporting to pdf, so I need to create "something" that can be printed with jasper reports that will take care of the html codes.

1
So effectively you ask: "how can I create a pdf from html"... search for that on stackoverflow. Hint: xhtmlrenderer works - Kukeltje
I change the question and added additional information to clarify what I am looking for , thanks for responding. - snafua
So it is not PrimeFaces related...html could have come from anywhere... I'm removing that tag and changing the title - Kukeltje

1 Answers

1
votes

You can use the HtmlComponent <hc:html/>

Example

<componentElement>
    <reportElement x="0" y="100" width="230" height="110" backcolor="#ADD8E6" uuid="332dd551-e8cd-4cb0-a11f-7325f481017b"/>
    <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="FillFrame" horizontalAlign="Left" verticalAlign="Top">
        <hc:htmlContentExpression><![CDATA["Hello<br/>World"]]></hc:htmlContentExpression>
    </hc:html>
</componentElement>

It will generate an image of your html.