why htmlcomponent on server looks different than in iReport?

0

Hello.

I want to generate a report with an html component.

If I compile it in iReport, the html component looks nice

(Description is a static text field; the html component is what you see in the right hand side):

 

BUT, if i compile from my server application, the html component appears all shrinked in the top left corner of the field:

 

 

The server application refers to the libraries:

jasperreports-4.7.1.jar

jasperreports-fonts-4.7.1.jar

htmlcomponent.jar

 

Can someone help on this?

Thank you!

Carlo

carlogenohm's picture
Joined: May 15 2012 - 5:18am
Last seen: 4 days 21 hours ago

3 Answers:

0

Check the output with Firebug. I think that it may be related on the CSS and Styles that are in the server.

Can you share the HTML that you are using insife the HTML component? 

marianol's picture
4908
Joined: Sep 13 2011 - 8:04am
Last seen: 1 year 3 months ago
About Firebug. While developing, I am running the application in the eclipse environment. And the report is exported to a pdf. could I check the CSS or styles directly from Eclipse?
carlogenohm - 7 years 2 months ago
Ok That changes everything..... I assumed that you where exporting as HTML from your server app. If it's a PDF is should be exactly the same as the PDF that iReport Exported, are you using ireport 4.7.1?
marianol - 7 years 2 months ago
Hi, no, I was using iReport 4.5.1 Now I checked that: - if I use iReport 4.7.1, I obtain in the preview the "wrong version", as in the export to pdf java application - so I went back to iReport 4.5.1, where the preview is correct. - but if i use jasper libraries 4.5.1 (also htmlcomponent.jar compiled from the 4.5.1 package) again i get the wrong result. Summarizing: - 4.7,1 gives wrong result in both iReport and Java application - 4.5.1 gives good result in iReport, wrong result in Java application
carlogenohm - 7 years 2 months ago
0

Thanks for the fast answer!

This is the html component:

<p>
    <strong>Rich text</strong></p>
<p>
    Description<br />
    <br />
    <strong>Bold text</strong><br />
    <br />
    <u>Underlined text</u><br />
    <br />
    Super<sup>script</sup></p>
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
    <tbody>
        <tr>
            <td>
                first column</td>
            <td>
                second col</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                second row</td>
        </tr>
        <tr>
            <td>
                third row</td>
            <td>
                &nbsp;</td>
        </tr>
    </tbody>
</table>
<p>
    &nbsp;</p>
 

carlogenohm's picture
Joined: May 15 2012 - 5:18am
Last seen: 4 days 21 hours ago

Jasper Server Overrides a lot of the standard HTML tags (like p , table, etc) via CSS to use their own fonts, widths, etc.
Check with Firebug on your browser and you will see the current styles that get applied to your table.

Just a quick looks at the CSS on Jasperserver you can see that the main font type and size has been overridden in theme.css:

body, textarea, .body, .title > .path, input, select {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
font-weight:normal;
line-height:1.182em;
}

To get the output you want you will need to use your own CSS styles in the HTML.

marianol - 7 years 3 weeks ago
0

Reposting my comment as an answer since the comment got scrambled:

 

Jasper Server Overrides a lot of the standard HTML  tags (like <p> , <table>, etc) via CSS to use their own fonts, widths, etc. 
Check with Firebug on your browser and you will see the current styles that get applied to your table. 
 
Just a quick looks at the CSS on Jasperserver you can see that the main font type and size has been overridden in theme.css:
 
body, textarea, .body, .title > .path, input, select {
  font-family:Verdana, Arial, Helvetica, sans-serif;
  font-size:11px;
  font-weight:normal;
  line-height:1.182em;
}
 
To get the output you want you will need to use your own CSS styles in the HTML.
marianol's picture
4908
Joined: Sep 13 2011 - 8:04am
Last seen: 1 year 3 months ago

It does not work in iReport neither: submitted a bug, issue 2656

carlogenohm - 7 years 3 weeks ago
Feedback