BIRT report PDF font - pdf

I am trying to embed a font in my BIRT pdf export. I am running the report from my webserver in the Tomcat/webapps/birt dir.
I checked the Fontsconfig.xml which points to the dir path
<path="/usr/share/fonts/default/TrueType" />
I have created the dir on my server as usr/share/fonts/default/TrueType and placed the (.ttf) font that I use in the report. I have updated my fonts cache via sudo fc-cache -fv, and I have restarted Tomcat. However, when I export my report to PDF form, the font does not get not used in the pdf.
Am I missing something?

Related

Can't upload theme to Prestashop

So I purchased a prestashop theme from TemplateMonster and the zip file is 324MB and when I try to upload the file in admin, I get an error that the file is too large. I know I can change php settings and maybe get it to work, but I figured I would just ftp it to my server, but filezilla drops the connection when I try to upload it. First, before I change php settings, will it work with such a large file? Also, when I look inside the zip file, I see a .sql file, a psd.zip, readme_en.zip, and 2 other zip files. Do all these files need to be uploaded? Just asking because I'm not sure why the PSD.zip file would need to be included.
413 Request Entity Too Large
Probably the main theme package contains additional assets, but in order to have your theme installed in Prestashop you just need the "main" ZIP theme
(the one that once unzipped contain folders like /assets /templates /modules etc.)
Then you can choose to upload it from your backoffice (you need to set the PHP max_upload_filesize accordingly) or copy the zip directly in your /themes directory and choose the "Import with FTP" option for the "Themes & Logo > Theme > Add new theme" backoffice page.
If you're having trouble with that method too, you can use the "Import from the web"
method by uploading your ZIP in a reachable public URL

PhantomJs specifying custom font (.ttf) location

We are using PhantomJs 2.1.1 on Unix server to convert HTML pages to PDF files. The font we want to use is a proprietary font, hence for UI we are sending the font file along with html content. However, due to some known issues (Issue1, Issue2) PhatomJs does not work properly if the font is not being fetched locally.
By default Unix font are stored at usr/share/fonts/. However, we do not have access to this location, can I provide custom font file location directly to PhantomJs?

Load PDF in Vaadin from Resource

I designed a Document Viewer in Vaadin that displays PDF files to the user. I successfully added the PDF to the viewer by specifying the system path. The problem is when I run the Viewer in a remote system, the PDF isn't displayed. So is there any way to load the PDF using the resource like we load the images.
Here is my code:
File pdfFile = new java.io.File ("D:/WorkFiles/PDF Books/newsletter.pdf");
The pdf is loading only from the local system. I have tried adding the pdf in the themes folder, but it doesn't work.
Thanks in advance.
What about the https://vaadin.com/api/com/vaadin/server/StreamResource.html. You can use this for on demand generated PDF files.

Windows Phone 8 don't added pdf files at build

Comparing the source and the console log I saw that all pdf files aren't adding. For this reason (obviously) the app crash when I call some pdf file. Another files (.png, .xml, .html, ...) don't have any problems.
What is the reason? I need add to another location?
thx
You should try to set build action for your *.pdf files to "Content". It works in my project.

Font is not available to the JVM with Jasper Reports

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/