Jump to content
We've recently updated our Privacy Statement, available here ×

Apply CSS to HTML injected into a PDF report


tony-dfs

Recommended Posts

Hello everyone,

I am currently updating an application that uses jasperreports in version 6.0.3 to the latest. Everything works, PDF reports are correctly produced, but I noticed a bug, in fact the CSS style is not applied.

Here is an example of what I write in my jrxml file: 

<parameter name="synthesis" class="java.lang.String"/>

<textField textAdjust="StretchHeight">
      <reportElement x="20" y="60" width="555" height="3" uuid="d127gg55-c50a-4298-b5y7-7f17596bu752">
                <property name="com.jaspersoft.studio.unit.y" value="px"/>
                <property name="com.jaspersoft.studio.unit.height" value="px"/>
      </reportElement>
      <textElement markup="html"/>
      <textFieldExpression><![CDATA[$P{synthesis}]]></textFieldExpression>
</textField>

I looked for solutions, there are flying saucer that could work or maybe I can use jrtx files, I don’t know if there is any other solution.

Anybody got any idea how to fix this ? 

Thx

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
 

Link to comment
Share on other sites

For example, this html/css work :

<html>hello<div class='div-fullpage'>Div 2<h1>title</h1></div><span style="text-decoration: underline; color: red;">underligned red text</span></html>

But css attributes like margin-top, padding-left, etc ... doesn't work. An other problem is bold or italic in CSS doesn't work, so i tried to use <b> or <strong> tags but the text is not displayed in bold.

<html><b>hello</b></html> in this case, the text is display in the report but not in bold...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...