English 中文(简体)
Unwanted font Helvetica in PDF from Jasper
原标题:

When I create a PDF from a Jasper Report, the resulting PDF declare to use "Helvetica" font, even if it doesn t contain text. Unfortunately I cannot embed "Helvetica" font, because it is not among the Windows fonts. Based on the PDF/A rules, I need to embed all the fonts in the PDF file.

How can I create from Jasper a PDF that doesn t declare to use Helvetica?

Thank you in advance.

Fabio

问题回答

Here s an explanation by Teodor Danciu, the main architect of the JasperReports Library:

https://community.jaspersoft.com/jasperreports-library/issues/5368

Apparently, to avoid using Helvetica, you can create a default style that uses one of your fonts.

You could try out a few things, have you look into the reportFont element?

<!ELEMENT reportFont EMPTY> 
<!ATTLIST reportFont
     name CDATA #REQUIRED 
     isDefault (true | false) "false" 
     fontName CDATA #IMPLIED 
     size NMTOKEN #IMPLIED 
     isBold (true | false) #IMPLIED 
     isItalic (true | false) #IMPLIED 
     isUnderline (true | false) #IMPLIED 
     isStrikeThrough (true | false) #IMPLIED 
     pdfFontName CDATA #IMPLIED 
     pdfEncoding CDATA #IMPLIED 
     isPdfEmbedded (true | false) #IMPLIED
> 

However, note that report fonts are now deprecated, so you might wanna check out the style element:

<!ELEMENT style (conditionalStyle*)> 
<!ATTLIST style
     name CDATA #IMPLIED 
     isDefault (true | false) "false" 
     ...
     forecolor CDATA #IMPLIED 
     isStyledText (true | false) #IMPLIED 
     fontName CDATA #IMPLIED 
     fontSize NMTOKEN #IMPLIED 
     isBold (true | false) #IMPLIED 
     isItalic (true | false) #IMPLIED 
     isUnderline (true | false) #IMPLIED 
     isStrikeThrough (true | false) #IMPLIED 
     pdfFontName CDATA #IMPLIED 
     pdfEncoding CDATA #IMPLIED 
     isPdfEmbedded (true | false) #IMPLIED
     pattern CDATA #IMPLIED 
     isBlankWhenNull (true | false) #IMPLIED
>

pdfFontName should be the name of the font you are planning to use. This could either be a predefined PDF font or the name of a TTF file present in the classpath. In case you are using a TTF then note that isPdfEmbedded specifies whether an external TrueType font (TTF) file should be included in the PDF file or not

Regards!





相关问题
org.xml.sax.SAXParseException with JasperReports [closed]

Sorry for dummy question, but i lost my whole day to start with JasperReport. The problem is that i always receive this exception: "org.xml.sax.SAXParseException: Premature end of file." when i am ...

Unwanted font Helvetica in PDF from Jasper

When I create a PDF from a Jasper Report, the resulting PDF declare to use "Helvetica" font, even if it doesn t contain text. Unfortunately I cannot embed "Helvetica" font, because it is not among the ...

Jasper Reports Excel output

I need to generate a report in Excel format using Jasperreports. I am using iReports 3.7.0 The reports gets generated with no issues except the size of empty cells. Can somebody please tell how to ...

user report generation by various attributes

User table contains the following attributes (dateOfBirth, race, gender, ...). We would like to generate a report in the following format. Year Race All Male Female 2000 Asian 2000 1000 1000 ...

Convert RTF files to DOC

I generate a report in doc format using Jasper, Jasper uses JRRTFExporter to generate doc reports, but wen i try and compare doc reports using POI it throws exception stating some header issues. Is ...

IReport Case in Variable

I write this code in one variable in the IReport $F{wbsWbkRef.wbkStdRef.stdBlRtntp.blCode} != null ? ReportUtil.getFirstEntity($P{JPA_ENTITY_MANAGER}, "SELECT "+ "CASE WHEN std.stdBlRtntp.blCode ...

热门标签