Jump to content
Changes to the Jaspersoft community edition download ×

again: Using styled text in PDF export


mnaeher

Recommended Posts

Ooops, looks like my markup examples have scrambled the text ...

OK, next try ...

Hi There,

 

I have a problem using styled text in PDF export.

My application uses JasperReport for creating PDF documents. These are made of text modules, which are stored in my datasource.

Within these text modules, there are small parts in bold, italic, and underline.

At first, I tried HTML markup <b>, <i>, <u>.

That worked in the iReport preview, but in the PDF, only <u> had an effect.

Looking at the examples, I found the <styleisBold="true" pdfFontName="Helvetica-Bold">.

OK, that worked in PDF also, but has the disadvantage that an explicit font name has to be specified in the datasource.

And that is bad because different users will use the same datasource with different layouts (including different fonts).

And with the font name in the <style>, all bold text will have the same font, ignoring what font is specified in the jrxml for thereport.

 

Is there a way to have bold or italic text in PDF export without specifying the font in the datasource ?

Note: I can not put the whole textfield in bold because it's always only a few words that are in bold.

 

Thanks and Regards,

Markus

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Use the FontMap to map your report fonts to the pdf fonts.

see here: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=51655

So we don't have any styled Text infos within the texts in database. Just the simple html-tags. But we just work with simple font's (artial, times, courier), so not special ones.

Just give it a try

hth

C-Box

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