Jump to content
Changes to the Jaspersoft community edition download ×

PDF Font Not DIsplaying Bold


robsil

Recommended Posts

I have a text field that is showing a disclaimer at the bottom.  The word "Disclaimer:" is bolded but the rest of the text is not.  I use a style tag with rtf markup to achieve this.  When I show in jasper, it is bolded fine but when I export to PDF it dissapears.  I have seen similar issues but am not clear on how to resolve this.  How can I configure it so that my PDF shows the word(s) I desire bolded using the <style> approach?

 

Sample text field:

"<style isBold="true" >DISCLAIMER: </style>This report is confidential.  <style isBold="true" >Do not share. </style>  If found, please destroy."

 

My desired report font is Calibri 10 Italicized.

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

if you would like to use style tags, you should be using html field instead of a text field. Note: jasperserver does not support html fields anymore.

try to use html field with expression "<b>DISCLAIMER:</b> This report is confidential. <b> Do not share. </b> If found, please destroy."

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0  --><!-- 2017-02-24T10:57:29 --><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="pdffont" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8a331d21-2608-405b-a765-e33dc06ccc20">    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>    <queryString>        <![CDATA[select * from dual]]>    </queryString>    <field name="DUMMY" class="java.lang.String"/>    <background>        <band splitType="Stretch"/>    </background>    <columnHeader>        <band height="30" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="100" height="30" uuid="24ad440f-d8b5-4cc1-9b93-7fe5a84fd623"/>                <text><![CDATA[DUMMY]]></text>            </staticText>        </band>    </columnHeader>    <detail>        <band height="30" splitType="Stretch">            <textField>                <reportElement x="0" y="0" width="100" height="30" uuid="05d3e22a-71c0-4b73-9fee-d6b4db7cbb83"/>                <textFieldExpression><![CDATA[$F{DUMMY}]]></textFieldExpression>            </textField>        </band>    </detail>    <pageFooter>        <band height="31" splitType="Stretch">            <componentElement>                <reportElement x="0" y="0" width="555" height="31" uuid="01041075-7c49-4fbf-b169-39e8befc78ee"/>                <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle">                    <hc:htmlContentExpression><![CDATA["<b>DISCLAIMER:</b> This report is confidential. <b> Do not share. </b> If found, please destroy."]]></hc:htmlContentExpression>                </hc:html>            </componentElement>        </band>    </pageFooter></jasperReport>[/code]

 

Link to comment
Share on other sites

Not sure how you're specifying your font but I just added Calibri as a font extension to Jaspersoft Studio and used <div style='font-family:calibri'> to specify the font and I'm getting Bold in my PDF. Most of the time, this happens when the font doesn't contain "bold" glyphs. I just downloaded Calibri from Font Palace.

Font Extensions

http://community.jaspersoft.com/wiki/custom-font-font-extension

Font download

http://www.fontpalace.com/font-details/Calibri/

[/code]
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.0.final using JasperReports Library version 6.3.0  -->
<!-- 2017-02-26T09:43:53 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="pdffont" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8a331d21-2608-405b-a765-e33dc06ccc20">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[select * from dual]]>
</queryString>
<field name="DUMMY" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="30" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="100" height="30" uuid="24ad440f-d8b5-4cc1-9b93-7fe5a84fd623"/>
<textElement>
<font fontName="Calibri"/>
</textElement>
<text><![CDATA[DUMMY]]></text>
</staticText>
<staticText>
<reportElement x="120" y="0" width="100" height="30" uuid="f1122908-1d74-4f38-bdfe-0b11136770e3"/>
<textElement>
<font fontName="SansSerif"/>
</textElement>
<text><![CDATA[DUMMY]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="30" splitType="Stretch"/>
</detail>
<pageFooter>
<band height="30" splitType="Stretch">
<componentElement>
<reportElement x="0" y="0" width="555" height="30" uuid="01041075-7c49-4fbf-b169-39e8befc78ee">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle">
<hc:htmlContentExpression><![CDATA["<div style=font-family:calibri'><b>DISCLAIMER:</b> This report is confidential. <b> Do not share. </b> If found, please destroy.</div&gt]]></hc:htmlContentExpression>
</hc:html>
</componentElement>
</band>
</pageFooter>
</jasperReport>
 

 

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