adepue Posted July 20, 2006 Share Posted July 20, 2006 In my version of Jasper reports (from 2/28/06), the bold style is not appearing in pdf output. If I have stylized text (for example, "<b>This</b> should be <b>bold</b>"), the bold parts appear bold in the jasper output, but not in the pdf. The only way I can get bold in pdf is to force the pdf font for that element to be a bold font (pdfFontName="Helvetica-Bold" for example), but that bolds the entire string and does not allow me to control it via the style markup <b>.Does Jasper support stylized bold markup in pdf output? Am I just missing something here? Link to comment Share on other sites More sharing options...
teodord Posted July 21, 2006 Share Posted July 21, 2006 Hi, Yes, you are missing the font mappings that need to be passed to the exporter using the FONT_MAP exporter parameter.You can see this being used inside our /demo/samples/styledtext sample provided with the project. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
adepue Posted July 21, 2006 Author Share Posted July 21, 2006 Ah ha, that's really good to know. Thanks! Link to comment Share on other sites More sharing options...
algol Posted April 24, 2009 Share Posted April 24, 2009 Hi Teodor,Does JasperReport 1.1.0 support this feature?I have added FONT_MAP parameter to PDF exporter - did not help.I think this is because PdfFont class does not have 2 new extra attributes: boolean isPdfSimulatedBold boolean isPdfSimulatedItalicIs there any other way in this version to tell to PDF exporter about stylized text markup ? Thank youCode:JRPdfExporter exporter = new JRPdfExporter();FontKey keyArial = new FontKey("Arial", false, false); PdfFont fontArial = new PdfFont("Helvetica","Cp1252",false); FontKey keyArialBold = new FontKey("Arial", true, false); PdfFont fontArialBold = new PdfFont("Helvetica-Bold","Cp1252",false); Map fontMap = new HashMap();fontMap.put(keyArial,fontArial);fontMap.put(keyArialBold,fontArialBold); exporter.setParameter(JRExporterParameter.FONT_MAP,fontMap); Link to comment Share on other sites More sharing options...
teodord Posted May 27, 2009 Share Posted May 27, 2009 Hi, JR 1.1.0 is now too old. Please consider upgrading. Thank you,Teodor Link to comment Share on other sites More sharing options...
hopesolutions Posted April 1, 2010 Share Posted April 1, 2010 Ok, this thread is old, but i still have the issue:I upgraded from jasper-reports 2.0.5 to 3.7.1, and started updating the jrxmls. before i uses to use pdfFontName="Helvetica-Bold" to get the bold effect, but now i am using only isBold="True".in iReport the preview is ok, but printing from the web application i get no bold at all.what should i do to enable the isBold on the default Helvetica font? FONT_MAP is old as many writes in this forum.... is there a ready font-extgension for helvetica fonts? Link to comment Share on other sites More sharing options...
minhduc Posted April 1, 2010 Share Posted April 1, 2010 Pdf Embedded mode was turned on?<font fontName="Arial" pdfFontName="arialbd.ttf" isPdfEmbedded="true"/>In my sample, html report file will be in Arial font and normal style. But in pdf file, it displayed in bold style.Remember copy arialbd.tff font to your application class path.Äức, Trần Minh ductm@fpt.com.vn Link to comment Share on other sites More sharing options...
hopesolutions Posted April 1, 2010 Share Posted April 1, 2010 I want to stay away from the arial font and embedding.the question is how does iReport 3.7.1 work with just:<font isBold="true" /> while when in application it doesn't? does ireport pass extra params/maps? use extra libraries? Link to comment Share on other sites More sharing options...
minhduc Posted April 1, 2010 Share Posted April 1, 2010 @hopesolutions:Nothing extra library need here.In font tag, fontName, isBold, isItalic or isUnderline property are not useful for pdf report exporter.In pdf report , the text style depend on the font filename.Example: If you want the text in pdf report file in Arial and :- Bold: pdfFontName="arialbd.ttf"- Italic: pdfFontName="ariali.ttf"...make sure isPdfEmbedded="true" and embeded fonts were on your classpath application<font pdfFontName="arialbd.ttf" isPdfEmbedded="true"/> Äức, Trần Minh ductm@fpt.com.vnPost Edited by minhduc at 04/01/2010 11:17 Link to comment Share on other sites More sharing options...
hopesolutions Posted April 1, 2010 Share Posted April 1, 2010 I might have fixed the issue by making a font extension to map standard SansSerif font to Arial, with nothing to change in current reports, just put the jar in the application folder and printing shows bold with only isBold....Code:<bean id="fontSansSerifFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="SansSerif"/> <property name="normal" value="fonts/arial.ttf"/> <property name="bold" value="fonts/arialbd.ttf"/> <property name="italic" value="fonts/ariali.ttf"/> <property name="boldItalic" value="fonts/arialbi.ttf"/> <property name="pdfEmbedded" value="false"/></bean>Post Edited by hopesolutions at 04/01/2010 13:39 Link to comment Share on other sites More sharing options...
marco159 Posted August 10, 2010 Share Posted August 10, 2010 The solution provided by "hopesolutions" works fine!I added to the java classpath ( /WEB-INF/classes ):1) jasperreports_extension.properties:net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistryFactorynet.sf.jasperreports.extension.fonts.spring.beans.resource=fonts.xml2) fonts.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="fontSansSerifFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily"> <property name="name" value="SansSerif"/> <property name="normal" value="fonts/arial.ttf"/> <property name="bold" value="fonts/arialbd.ttf"/> <property name="italic" value="fonts/ariali.ttf"/> <property name="boldItalic" value="fonts/arialbi.ttf"/> <property name="pdfEmbedded" value="false"/> </bean></beans>3) "fonts" folder containing these fonts:arial.ttfarialbd.ttfarialbi.ttfariali.ttfHope this helps!Marco Link to comment Share on other sites More sharing options...
inimish Posted September 15, 2010 Share Posted September 15, 2010 Hi,Do i need to change the jrxml or the exporter?I tried making a jar out of the components you suggested and got the jar in my classpath, yet isBold is not working for me. Link to comment Share on other sites More sharing options...
maxio89 Posted November 26, 2013 Share Posted November 26, 2013 I had similar problem, in iReport preview was ok, but generated pdf had no any bold styles either font extension nor iReport/JasperReports library settings didn't help. In my case it was enough to add one extra dependency and it helped. There is a short description in below post: http://blog.itcrowd.pl/2013/11/bold-style-missing-in-jasperreports.html Link to comment Share on other sites More sharing options...
sanfinns Posted January 11, 2015 Share Posted January 11, 2015 Thank you so much! This really helped me. Link to comment Share on other sites More sharing options...
reeeval Posted June 30, 2015 Share Posted June 30, 2015 Thank you! Link to comment Share on other sites More sharing options...
Fordy Posted June 28, 2019 Share Posted June 28, 2019 I recently came across the same problem and simply dragging the jasperreports-fonts-6.7.0.jar file into my project fixed this. In an attempt to minimise the number of jar files I'd not included this jar file even though it was part of what I'd downloaded from the site! Link to comment Share on other sites More sharing options...
Praharsh.v Posted February 27, 2020 Share Posted February 27, 2020 I am using tibco software for designing the jasper report, in my case i am able to generate the bold text in PDF for solution check on this blog https://real-world-reality.blogspot.com/2020/02/how-to-get-bold-text-while-converting.html Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now