I began using iReport for creating JasperReports since version 4.5.1 and then I started using 4.6.0 and created a couple of reports with it. The problem is that whenever I open the "old reports" (generated in 4.5.1) the textfields' fonts appear white coloured (it becomes "invisible" to me). When I double-click it, it shows the text, but it's terrible for edition because I can't see how the text is being displayed on the page.
It works fine with documents created by 4.6.0 and opened by 4.6.0, but not with documents created by previous versions. I guess it has to do with its xml (an attribute maybe).
Things I tried:
(1) Select another colour [green] for the font. (2) Open the .jasper compiled file and generate a new .jrxml.
Thanks in advance :D
Nevermind, I found out what was causing the "bug". It happens that the first report I created in iReport 4.5.1 was saved on Windows with Arial font (which doesn't exist in Ubuntu/Linux). So I deleted the "fontName" tags on the JRXML file.
Some fonts are not available on linux and if your report template use them, you will have the described problem. If you want to still use the Arial or some other non-linux fonts, you can try to install this package and retry:
sudo apt-get install msttcorefonts
Related
When I run my project under NetBeans it works, and the Arabic text is formatted correctly. But when I build the project and send it to the client, the Arabic text is reversed.
The same thing also happens to me. When I open the jar file of the project, I see that the language is reversed. I need a solution knowing that Arabic words are written inside jLabel.
When I run the project from within NetBeans, these are the correct results:
And these are the incorrect results when I open the jar file after building the project:
Well guys, I finally discovered the error which is the font type. I put the font type in NetBeans (Times New Roman)
And I discovered that NetBeans supports this type of font, but Windows does not support it, so it makes the sheep inverted and only this problem and I hope that no one will fall into this slander after me: and it is better to use this type of font (Tahoma) because all devices support it And it does not show any problem, thank you
I'm getting an net.sf.jasperreports.engine.util.JRFontNotFoundException. I've already added the font in Jaspersoft Studio like how it was described here: When export a report to PDF change the font .
I've also exported the font extension and placed the jar where my classpath can see it like how it was described here: How can I display "$£Ω€απ⅔" in Jasperserver PDF using iReport? .
I'm still getting the error. Does anybody know any other solution that might help? Thanks in advance.
I ran into similar problem. The cause of my problem was that the font I was trying to use was installed on my computer (Windows) but was not installed on our deployment environment (Linux). So the problem occurred on Linux. So we needed simply to install required font on that system. (The problem occurred for PDF files only). So, check if you actually have the font in question on your system (try to find it in editor (such as MS Word - for windows). If you don't have the phont, install it. Google "How to add tryetype font on [your system name: Windows, Linux or whatever you are using]"
I solved this problem by exporting it as .zip instead of .jar, extracting the contents of the .zip and placing them under classpath.
More details on this in this blog (Solution 3): http://poor-developer.blogspot.com/2017/02/jasper-reports-using-unavailable-fonts.html
Before asking the question, I searched for a similar question on StackOverflow:
file was loaded in the wrong encoding: 'UTF-8' in android studio
But it did not give an explicit answer there.
My issue is that the project is downloaded from the network, and it is an eclipse project, I open it with IntelliJ IDEA, and get this issue:
As Tarik point out, click the Reload in another encoding, and if you want UTF-8 encoding, then click the more -> UTF-8.
in my case , when i uploaded the first .ttf file in assert folder , android studio asked me to choose one file type , and when I selected text type . this problem start to appear .
the right file type is : 'Files Opened In Associated Applications'.
to fix your problem , you have to open preferences ->Editor ->File Types and search for .ttf extension then remove it and add it again under 'Files Opened In Associated Applications'
I was having the same problem..
and i solved it by changing the CR to CRLF
AND then refresh the project
like done in following image
You can try opening your file with an other text editor, like Notepad++. Sometimes it can detect the correct encoding of your file, using a different pattern than IntelliJ.
Then you will be able to use the "Reload..." of IntelliJ.
Click on setting symbol just right side of error and select suppress for class.
That works for me and resolve my issue.
My colleague works on Windows while I work on Ubuntu 16.04
Click the Reload in another encoding, and click the more -> GBK.
Then we can see the Chinese character.
I tried all possibilities posted here but any success with them, what worked was just to re import the project
Though the encoding setting was present in the pom.xml, IntelliJ was trying to load all test files using UTF-8 instead of ISO-8859-1, so I found this in the IntelliJ docs: Encoding in IntelliJ
Which, it basically was...
Open preferences (in macOS hit, command + ,)
Go to Editor / File Encodings
Select the project correct encoding if it defers from your pom.xml - project.build.sourceEncoding
By doing so, it did stop asking me to reload the file with the correct encoding.
If you have previously loaded this file without problems, and this is a new issue for you, try invalidating the caches in your IDE.
An easy way to open this option is by opening the super-search functionality (hit shift twice) and search for 'cache' in the 'actions' tab.
When prompted, choose the following option:
I'm trying to generate report with DynamicJasper, but I'm getting the following error:
net.sf.jasperreports.engine.util.JRFontNotFoundException:
Font 'Arial' is not available to the JVM.
msttcorefonts is installed, but I guess the JVM is not using any fonts from it.
I'm using Ubuntu 10.04.
How can I fix this?
I tried installing mscorefonts, but the package was installed and up-to-date.
sudo apt-get update
sudo apt-get install ttf-mscorefonts-installer
I tried searching for the font in the filesystem, with:
ls /usr/share/fonts/truetype/msttcorefonts/
This folder just had the README, with the correct instructions on how to install.
cat /usr/share/fonts/truetype/msttcorefonts/README
You need an internet connection for this:
sudo apt-get install --reinstall ttf-mscorefonts-installer
I re-installed ttf-mscorefonts-installer (as shown above, making sure to accept the EULA!) and the problem was solved.
JasperReports raises a JRFontNotFoundException in the case where the font used inside a report template is not available to the JVM as either as a system font or a font coming from a JR font extension. This ensure that all problems caused by font metrics mismatches are avoided and we have an early warning about the inconsistency.
Jasper reports is trying to help you in your report development, stating that it can not export your report correctly since it can not find the font defined in TextField or StaticText
<font fontName="Arial"/>
Yes you can disable this by setting net.sf.jasperreports.awt.ignore.missing.font to true but you will have export inconsistencies.
Yes you can install the font as JVM system font (but you need to do it on every PC used that may generate report and you can still have encoding problems).
The correct way!
Use Font Extensions!, if you like to create your own (see link below), jasper reports also distributes a default font-extension jar (jasperreports-fonts-x.x.x.jar), that supports fontName DejaVu Sans, DejaVu Serif and DejaVu Sans Mono
<font fontName="DejaVu Sans"/>
From the JasperReport Ultimate Guide:
We strongly encourage people to use only fonts derived from font
extensions, because this is the only way to make sure that the fonts
will be available to the application when the reports are executed at
runtime. Using system fonts always brings the risk for the reports not
to work properly when deployed on a new machine that might not have
those fonts installed
Links on StackOverflow on how to render fonts correctly in pdf
Checklist on how to render font correctly in pdf
Generate font-extensions with JasperSoft Studio
Generate font-extensions with iReport
I use IReport to install font:
tools -> options -> fonts -> click install font
Then select the font and click
-> export as extension and type name myfont.jar
add this jar and also spring.jar* to your build path.
*copy spring.jar from Jaspersoft\iReport-3.7.0\ireport\modules\ext
sudo apt-get install msttcorefonts works (on our Ubuntu development environment), but is not a very good solution.
Instead, we bundled the fonts with our application based on this tip. Their JAR file bundles the following fonts,
Arial
Times New Roman
Courier New
Comic Sans MS
Georgia
Verdana
Monospaced
Direct Link to download jar:
Maven ver 1.0. DynamicFonts
There are three method to avoid such a problem.
Method 1 : by setting ignore missing font property.
JRProperties.setProperty("net.sf.jasperreports.awt.ignore.missing.font", "true");
or you can set this property by entering following line into .jrxml file.
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
Method 2 : by setting default font property.
JRProperties.setProperty("net.sf.jasperreports.default.font.name", "Sans Serif");
or you can set this property by entering following line into .jrxml file.
<property name="net.sf.jasperreports.default.font.name" value="Sans Serif"/>
Method 3 : by adding missing font property.
Firstly install missing fonts in IReport by selecting " Tools >> Options >> Fonts >> Install Font " then select the all font and Export this By clicking on "Export as Extension" with .jar Extension.
You can use this jar for Jasperreports-font.X.X.X.jar which will be present in your project library or classpath.
For CentOS:
wget msttcorefonts
Then:
tar -zxvf msttcorefonts.tar.gz
cp msttcorefonts/*.ttf /usr/share/fonts/TTF/
fc-cache -fv
After all, restart JVM.
I solved this by choosing 'SansSerif' or 'Serif' only and not 'Arial' or 'Times New Roman'.
If you are using maven in your project, you can just add the jasper-fonts dependency to pom.xml:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.8.1</version>
</dependency>
Installing the missing font on the system may be a working solution but not for me, I didn't want to have to install the missing fonts after each deployment in a new server, instead I opted for embedding the font with the application.
Regards.
Try adding the line
net.sf.jasperreports.awt.ignore.missing.font=true
to your jasperreports.properties file.
Jasper stops finding one font
For Debian
add
non-free contrib
to deb and deb-src in /etc/apt/sources.list ie:
deb http://ftp.debian.org/debian/ squeeze main non-free contrib
deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib
Then
apt-get update
apt-get install msttcorefonts
Of course you'll need to restart jasperserver. ie:
/opt/jasperreports-server-cp-4.5.0/ctlscript.sh restart
Change for your version / path.
I faced the issue with my web application based on Spring 3 and deployed on Weblogic 10.3 on Oracle Linux 6. The solution mentioned at the link did not work for me.
I had to take the following steps -
1. Copy the Arial*.ttf font files to JROCKIT_JAVA_HOME/jre/lib/fonts directory
2. Make entries of the fonts in fontconfig.properties.src
3. Restart the cluster from Weblogic console
filename.Arial=Arial.ttf
filename.Arial_Bold=Arial_Bold.ttf
filename.Arial_Italic=Arial_Italic.ttf
filename.Arial_Bold_Italic=Arial_Bold_Italic.ttf
You can do it by installing fonts, that means everywhere you want to run that particular application. Simplest way is just add this bl line to your jrxml file:
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
can make your custom fonts via iReport and converting like jars files
Create jasper report in multiple languages(Unicode)
1)Install font in ireport desginer
2)create extension of font(we will use it in applications classpath)
3)install font on os(optional)
4)paste all .ttf of font in jre->lib->fonts directory (otherwise web application will throw error font is not available to JVM)
You can use this library which packages the Liberation-fonts as JasperReport font extension, and registers them as Arial, Times New Roman and Courier:
https://mvnrepository.com/artifact/com.mpobjects.jasperreports.font/jasperreports-fonts-liberation
Actually I fixed this issue in a very simple way
go to your home path, like /root
create a folder named .fonts
copy your all your font files to .fonts, you can copy the font from C:\windows\fonts if you use windows.
sudo apt-get install fontconfig
fc-cache –fv to rebuid fonts caches.
Solution in 2 steps (if you are using centOS)
Download the Microsoft core fonts rpm package.
[root#WEBSVR~/]# wget http://www.itzgeek.com/msttcore-fonts-2.0-3.noarch.rpm
Install rpm package.
[root#WEBSVR~/]# rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm
Add the below in your .jrxml file:
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
Copy your Fonts on the following directory
JDK_HOME\jre\lib\fonts
Hey Having trouble viewing documents produced on Windows?
You can try a fine solution easy:
yum install curl cabextract xorg-x11-font-utils fontconfig
rpm -i
https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm
After this I need reboot my system CentOS6.
Source: http://mscorefonts2.sourceforge.net/
About a month ago I went from Windows to a MacBook Pro.
Same Eclipse version, (almost) same settings, but it frustrates me that saving an xml file takes about 10s :(... Even if I just delete/add a space char.
I have a lot of files, about 10 projects opens in Eclipse but my old Windows box with an old quad core (not even an i7) had no problems with this.
I know this is a knows problem in Eclipse and I had it in the past as well, but it was solved after a few upgrades in the past.
Currently I run on the latests Luna version, with up2date plugins, tried a lot of possible solution, most from SO, but still not solved. Please some help.
I am using EE Eclipse to mainly develop java web apps and use the following plugins: AspectJ (with Xref), EGit, JGit, CheckStyle, Maven, TestNG.
All files are stored as UTF-8
Editing the xml file is slow in both the text and the xml editor.
It concerns xml files that are located in a java package (in the /src/main/java/ folder).
The strange thing is that Editing an xml file in a project-root subfolder isn't slow, like: project-root/test-output/bla.xml (works well in both the text and xml editor)... weird...
Both files (the slow and fast save one) are part of version control and used by Git.
In case I copy the slow file to the folder project-root/test-output/, it's also saved fast :(
Renaming the slow file such that it has the "txt" extension and editing with the text editor has not effect.
I thought it is caused by some builder that works only on the java source folder...
The project has a Java and Maven builder. Disabling them has no effect.
The Eclipse log file doesn't contain any relevant exception. It contains some key-binding exceptions and resource tree locked modifications, but these exceptions are old.
What I tried (what I can remember):
+ Disabled all validation (especially the xml validation), for all projects.
+ Ensure all latest updates are installed of all plugins, including the EGit plugin.
+ Disabled Checkstyle.
+ ...
Any ideas as I am getting a bit frustrated about this?
A poor-man's solution may be in
switch to a empty workspace (workspace2 in example)
create a new pde-plugin-project (mytestplugin in example)
debug the mytestplugin means you debug a instance of eclipse too, so use the workspace you usually work with in the debugging-second-eclipse.
Now: save the xml-file in the debugging-second-eclipse with the workspace you usually work with, quick jump to the first eclipse and press "pause" to stop the second-eclipse.
inspect the compleate debug-stacktrace-thread-tree in the debug view (please post the image as a comment here).
Regards
When Trying the solution of #Peter I noticed that the workspace I was using was located in the "eclipse.app" file like this:
/Applications/eclipse/Eclipse.app/Contents/MacOS/D:\Users\Ed\Develop\Projecten\EclipseWorkSpace/
No idea why/how this happened. However, I moved this workspace to a "normal" directory in my home folder, and how saving an xml file work normal, fast as expected...
No idea why having the workspace located in the eclipse.app made it slow, but it works ...
Open eclipse.ini.
Increase -Xms, -Xmx
This works for me.