Jump to content

Alignment Style (left, right, center) with HTML Markup doesn't work when produce a PDF


guiprofr

Recommended Posts

 Hi,

I tried to produce a PDF with ireport 3.7.4 and HTML markup. Many markups works except the align style. I started with a blank report and just added a "Text Field" with html markup property. The text is : <div style="text-align: center;">Test</div>. When I preview it in HTML format, it works fine but not in PDF, DOCX, ODT format : the text is left-aligned.

Do I something wrong ? Is there a way to do it ? (in this field I don't want all text center-aligned but just some paragraphs so I can't change the property alignment of the "Text Field").

Thanks for your help.

Guillaume. 

Link to comment
Share on other sites

  • 1 month later...
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

HTML markup is a feature of our text field element. I repeat "text field element".

Only a limited set of text format tags are supported. This feature is for producing styled text.

Not for introducing divs, tables, image, iframes, or anything else. These are not text.

The alignment is not among supported styling because it is not about how text characters look, but about how you lay them out. We cannot change the alignment of text within the same text field element.

To verify this, try create a text field element with iReport and use different alignments within its content. If you cannot do that with iReport, it means you cannot do that even if you use markup HTML, because in the end, it will still be a simple text field.

 

What you need is an HTML renderer component like the one logged here:

http://jasperforge.org/projects/jasperreports/tracker/view.php?id=4256

 

I hope this helps.
Teodor

 

Link to comment
Share on other sites

Hi Teodor,

 

I do agree with you that Jasper Reports must not and should not be able to render full HTML markup for text fields and that it does make sense to restrict the number of supported tags.

 

The tough decision IMHO is, however, where to draw the line. Certainly a lot of people would agree that complex stuff like iframes, tables or the like are not needed. However, "basic" out of the box support of certain CSS style layout properties would be a really nice to have feature.

 

We are not talking about a fully fledged HTML renderer here, but additional features I would really like to see included in the HTML markup renderer would include different alignments within a text field and the possibility for indentation of a block of text within a text field.

 

Just to get my point across - Basic layout features would be awesome and IMHO you already support layouting to some extend, because for example you already can have a text field with text of different sizes - IMHO size as well is about layouting and not about how the characters look like.

 

Link to comment
Share on other sites

Hi,

 

We would probably try to do something about alingment in a future version.

 

However, I'm a bit concerned about the request to support CSS. If we go the CSS route, there is no end in sight for what people would expect to work in our humble text elements.

Once you start attaching inheritable CSS properties to elements, it basically means you have to be able to understand all HTML tags, even if you do not render them, but for the sake of ensuring inheritance of styling through containers.

 

So if you talk about CSS, I still think you need to go with the HTML renderer component that I already mentioned.

 

Thanks,

Teodor

 

Link to comment
Share on other sites

  • 3 weeks later...

 Hi Teodord,

 When you say "We would probably try to do something about alingment in a future version" do you have an idea of date ? It is more some weeks, some months ? (or perhaps it is already done in 4.0.1 ). It's important for us to know and so decide if we have to find a bypass.

 

Thanks.

 

Regards.

Guillaume

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...