BIRT is unable to render Hindi language characters in generated PDF file. The same design file, when rendered as Word document or HTML or any other format, I am able to see the unicode characters.
I have set Arial Unicode MS as the font type in the design file and tried with few samples from google translate. Please let me know if I'm missing anything.
Thank you.
The most probable BIRT can't find correct font files.
You have to configure pdf fonts correctly (see. file fontsconfig.xml).
I've similar issue with Cyrillic and Chinese fonts.
What I fixed in the file:
...
<font-paths>
<path path="fonts" />
<!--path path="C:/windows/fonts" />
<path path="d:/windows/fonts" />
...
<path path="/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType" /-->
</font-paths>
Create fonts folder and put all necessary fonts (a bit tricky question is where fonts folder must be. It depends how you're using BIRT).
Optionally you can put correct font files in JRE/lib/fonts folder you're using.
If you are working on JavaFx Desktop App.It will work.
If you are using BIRT viewer deployment using fontsConfig.xml because all configs are bundled in org.eclipse.birt.runtime_VERSION-XXX.jar
So you can use this way just override fontConfig_Pdf.xml file and add your Font in this file
<composite-font>
<font font-family="mangal" catalog="Western"/>
</composite-font>
and after that add this line code in your BIRTserviceImpl Class where you are setting the RuntimeEngine
EngineConfig conf = null;
conf.setFontConfig(new File("fontsConfig_pdf_win.xml").toURL());
conf.setEngineHome("{dir}/birt-runtime-4_4_1/ReportEngine");
eng = new ReportEngine(conf);
this line will help to change runtime fonts config and
copy your hindi fonts and paste into jre/lib/Fonts and C:/windows/Fonts also
Related
Using Prestashop 1.6 - and on the PDF's (Invoice & delivery) the Russian Ruble symbol won't render properly, converts to a "square". It is working without problem on all other areas of our site. Does anyone know how I can fix this? Thank you
It is linked to the font include in TCPDF, i think the font use for your iso code not include this symbole.
The font folder for TCPDF is :
https://github.com/PrestaShop/PrestaShop/tree/1.6.1.6/tools/tcpdf/fonts
How to found the font use by TCPDF?
https://github.com/PrestaShop/PrestaShop/blob/1.6.1.6/classes/pdf/PDFGenerator.php
In this file you can know what font use for your country iso code
The font use depend to country iso code, so for RU the font is freeserif.
So the font freeserif not include Rouble.
Solution?
Solution 1
The easy solution is to change in the https://github.com/PrestaShop/PrestaShop/blob/1.6.1.6/classes/pdf/PDFGenerator.php the font for your iso code by (dejavusans, cid0jp, ..) depending font in the folder tools/tcpdf/fonts.
Solution 2
The second solution, is to download TTF file who include the symbol(example you can search/download a font in http://www.dafont.com/) and generate a valid file with online converter
http://fonts.snm-portal.com/ (it is a first result for my search in google)
After you upload the file(s) generated in folder tools/tcpdf/fonts and edit the file PDFGenerator.php to point to your new font.
I am using arial .ttf file. I have tried different font file for gujarati such as lohit, padmaa, shruti but it not displaying properly. The characters are not getting substituted properly.
In PDF it displays as :
અરથ પરજ ડરમ વૈભવ સવગે
Originally it should display as:
અર્થ પ્રજા ડ્રમ વૈભવ સ્વર્ગે
I have tried using GlyphSubstitutionTableReader but its not working for me.
Please guide me. Thanks in advance.
iText 5 currently doesn't support any Brahmic scripts. The reason is that these require an implementation of a specific font table called GSUB, which simply isn't there yet. There is no way to get this to display correctly with iText 5.5.5, but anyone is welcome to try and implement it.
I want to use Verdana as a font while stamping a PDF file with iText PDF. The original file uses Verdana, which isn't an option in the class Basefont.
Here is the function to create my font right now:
def standardStampFont() {
return BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false)
}
I'd like to change that to the Verdana Font, but simply exchanging the Part BaseFont.HELVETICA with "Verdana" doesn't work.
Any idea? Thanks in advance!
As documented, iText supports the Standard Type 1 fonts, because iText ships with AFM file (Adobe Font Metrics files). iText has no idea about the font metrics of other fonts (Verdana isn't a Standard Type 1 font). You need to provide the path to the Verdana font file.
BaseFont.createFont("c:/windows/fonts/verdana.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED)
Note that I change false to BaseFont.EMBEDDED because the same problem you have on your side, will also occur on the side of the person who looks at your file: his PDF viewer can render Standard Type 1 fonts, but may not be able to render other fonts such as Verdana.
Caveat: The hard coded path "c:/windows/fonts/verdana.ttf" works for me on my local machine because the font file can be found using that path on my local machine. This code won't work on the server where I host the iText site, though (which is a Linux server that doesn't even have a c:/windows/fonts directory). I am using this hard coded path by way of example. You should make sure that the font is present and available when you deploy your application.
Adding this line makes sure the FontFactory actually registers the fonts in the operating systems' default fonts directories:
FontFactory.RegisterDirectories();
After that all the installed fonts can be found using something like
var myfont = FontFactory.GetFont("Verdana", 10f, iTextSharp.text.Font.NORMAL);
I get that this post is old, but it's still relevant I guess.
I have a jar I include with my application with some fonts. If I paste around
<font fontName="NimbusSansGlobal Light" size="12" pdfFontName="NimbusSansGlobal Light" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
into all my text elements, PDF output works fine. If I switch them all to use a style which defines the font as such:
<style name="SansFontStyle" isDefault="true" pdfFontName="NimbusSansGlobal Light" pdfEncoding="Identity-H" isPdfEmbedded="true"/>, then the font can't be found by the JRLoader when I try to generate reports. Interesting enough, if I use JRLoader within my application directly, the font is found fine.
Why would styles break PDF export?
Using Font Extensions should solve this problem.
Once you use font extensions, then you can set the font in the text element or in the style. You will not specify pdfFontName, pdfEncoding, or isPdfEmbedded in the report. That gets specified in the font extension.
Note: In a strict interpretation, this doesn't actually answer the question. I have no idea why styles work differently from directly setting the fonts. It seems like a bug, but maybe it's unexpected yet intentional for some reason we aren't thinking of. Therefore, I started to enter this as a comment rather than an answer. But it got too long.
Regardless, this should allow you to use styles as you want to. So I expect that it will solve the heart of the problem.
Font extensions are documented in the JasperReports (and iReport) samples and documentation, so it should be pretty easy to use them once you know that you ought to.
I am trying to install a custom font into my iPhone application. When I add the 'Fonts provided by application’ key into my info.plist file I get the following error ': FT_Open_Face failed: error 85.’
I am not sure what the problem is as I have successfully been able to use custom fonts in the past.
Any help will be appreciated.
If you leave the first element in your font array in the plist (index 0) blank, you will get this error.
PostScript fonts cannot be used with UIFont directly. You can use them only with CoreText or CATextLayer.
This can occur if the font in question is a Font Suitcase format. Open your application package, and if the font .ttf file shows a size of "Zero bytes", it's probably a font suitcase.
Files of this type can be converted using Fondu.
When running Fondu, I had to specify not just the suitcase file, but the resource fork inside it:
fondu mysuitcasefont.ttf/..namedfork/rsrc
This will extract any fonts in the suitcase to the current directory. It is these extracted files you will want to include in your iOS project and reference from the .plist.
I received this error when using a .ttf font. I was able to correct it by removing the file extension from the filename in (a) the resource in xcode and (b) the "Fonts provided by application" array in the .plist file.
Hopefully this will help.
I was trying to use Google Signika font on my App, and got the exact issue.
I solve the issue by using the .otf version of the font
Accepted answer is totally wrong and unnecessary. Probably you made a mistake when writing your font name.
Thats rules for that.
First Step : Write font name before .ttf extension. Example: For FFFTusj.ttf => FFFTusj
Second Step : Write - and after font style. Example: Bold or Medium etc. Example: #"FFFTusj-Bold"
And also dont forget add your font file to your project.
Check this link:
http://www.bycoder.com/post/2013/03/28/XCode-Custom-font-doesnt-work
If your font is REGULAR dont write -Regular at end of font name.