I have a standalone program which uses Apache FOP 2.6 to write Hindi text to a PDF using Amiko font using the following font metric configuration (on CentOS 7 / Java 11):
<fop version="2.6">
<renderers>
<renderer mime="application/pdf">
<fonts>
<font metrics-url="Fonts/Amiko.xml" kerning="yes" embed-url="Fonts/Amiko.ttf" embedding-mode="full">
<font-triplet name="any" style="normal" weight="normal" />
</font>
<auto-detect/>
</fonts>
</renderer>
</renderers>
</fop>
The Hindi text produced by the above is correct and shows up as follows in the PDF
If I remove <auto-detect/>, it changes to
which is incorrect in almost every word.
So, with the auto-detect tag in place and using the same method with generates the PDF but called from an application server (Wildfly 18 in my case), it always generates the incorrect hindi text as in the last image above. I have tried putting script attribute with deva/dev2 values but it further deteriorates the hindi text in the PDF.
Please help me understand what is missing when the same code is run through app server.
Thanks for looking into this. The issue is resolved now.
It seems if additional font families are used in the XSL, they
cause this issue. In my case we needed only English & Hindi
together on the PDF, we removed the other fonts used from the
XSL & it is now producing the correct output.
Related
I'm building a web page that uses Google WebFonts (open sans) on a PC and it works perfectly, but when I try it on a mac computer it shows a question mark within the text. Why is this?
The character you are seeing is the replacement character, which is used when a font does not contain a particular Unicode character, in this case, "ñ" AKA U+00F1 AKA "Latin small letter n with tilde".
Google Open Sans does contain this character, so it seems that Safari is not correctly getting the font from the web. The rendering engine is then reverting to another font, and that one is missing the offending character. You will be able to check in dev tools on your mac which font is being grabbed by your script.
I checked the script annotation you posted in the comment to your question. You are returning the fonts in the woff2 format. It turns out that woff2 is not supported in Safari as of version 9, but woff is. I therefore recommend changing the format to woff and serving it to your page locally:
Download the script you posted (http://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700)
Save it as a css file (e.g. fonts.css)
Find-and-replace woff2 to woff
Save the file
Add it to your web project (however you add your other files)
Replace #StyleSheet({"fonts.googleapis.com/css?family=Open+Sans:300,400,500,700";}) with a reference to this newly uploaded file.
Solved! One of the developers had its Eclipse not set to UTF-8 so the file transfer using Git wasn't working properly...to check, go to Preferences>General>Workspace>Text file encoding and set to UTF-8
I'm using WAMP and CodeIgniter. I'm using DomPDF and it works really great. Now I want to change font to Verdana in the PDFs that are created. As I understand from doing som reading Verdana isn't included in the core files of domPDF, but it is possible to add fonts.
I just found this.
https://code.google.com/p/dompdf/source/browse/trunk/dompdf/lib/fonts/Verdana.ufm?r=96
But I want to download som font-files where Verdana is used for domPDF. How do I achieve that? (I'm looking for some download verdanafonts.zip or something like that)
I've tried to copy the contents of verdana.ufm and verdana.afm and saved them into the libs/fonts folder and change def("DOMPDF_DEFAULT_FONT", "serif"); TO def("DOMPDF_DEFAULT_FONT", "verdana"); but then I get an error that says verdana is an undefined index.
I'm using 0.6 version of domPDF.
In order to add a font to dompdf you have to parse it to produce the font metrics file (*.AFM and/or *.UFM). Then you have to tell dompdf about the font by editing lib/fonts/dompdf_font_family_cache.
dompdf has always had a mechanism to help you out with the process. The load_font.php file will take a font and so long as the necessary libraries are available will produce the metrics and update your font family cache. With dompdf v0.6.x the php-font-lib font parsing library is used to produce the font metrics.
You can also use the CSS #font-face declaration to load fonts on-the-fly.
I am converting html templates into PDF/A format using jod converter3(using open office 3x).This is working fine in the development environment(using Eclipse and JRE).
But while executing the same program on production(Linux,JBoss 5) some templates that have hindi characters in output pdf with ???
Working fine for english characters
Tried running my program via command line w/o app server still the same output.
java -cp bin:PATH/JARNAME.jar:lib ConvertToPDFA encoding=UTF8 x (Not working).
HTML is also UTF-8 encoded.
Please suggest the problem area.
Check for a hindi font tiff under the location usr\share\fonts\TTF.
if missing then create the same and place the required font tiff.
Following the instruction in this link ( https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf ), I always encounter an error when opening the pdf file created. The error message is:"Cannot extract embedded font 'TradeGothicLT-CondEighteen'.Some characters may not display or print correctly. " and when i click OK, the pdf displays black background and when i start highlighting the body, it captures the text but text are in black font-color. what should I do to get rid of this error?
There may be something wrong with your font cache, located at dompdf/lib/fonts/dompdf_font_family_cache.php (though the exact file name depends on your release and whether you have loaded fonts). This file tells dompdf what fonts are available for use in the PDF. If this file references a font that isn't actually available you can run into major issues on viewing. You may need to re-load your font files. Take a look at the Unicode how-to for an overview of using embedded fonts. This document hasn't been updated to reflect changes implemented in dompdf 0.6.0 beta 3, but the information is still pertinent.
I've been having a world of trouble getting Khmer fonts (an Indic script of Cambodia) to render reliably on the web across platforms (Mac, Windows, Linux).
Google web fonts recently added Khmer, which seems like the best bet. However, I have not been successful getting Khmer fonts to work on any Mac or Linux system. I can get them to work on Windows by installing the Khmer Unicode installer from http://khmeros.info but not by just including Google's font in an HTML file.
For example, see this screenshot of the Google web fonts page on a fresh Windows installation. You can see that the default Windows Khmer font (uuuuugly!) is being used instead of Danh's pretty fonts.
I have another test file here: http://dl.dropbox.com/u/634/khmer_test.html. For the first test, you should see something like this for both the web font and the default system font (assuming you have Hanuman installed). I have yet to find a system where both examples work reliably.
Any help would be greatly appreciated. My primary goal is to get this working on a website; a secondary goal is to get Khmer (and other Indic fonts) working in a PDF generator like iText (although I am aware iText itself does not support Indic fonts -- I'm hoping something similar does).
Every Cambodian Windows users are always delete the font name called: KhmerMool and Khmer Kampot. Then they change the default Khmer font in regedit too. You can check at http://thelifeandwork.blogspot.com/2010/01/changing-default-khmer-font-in-windows.html . I'm not sure about Khmer font and other Indic font in PDF. I always have problem when i copy Khmer unicode from PDF to put in OpenOffice or Office Word or LibreOffice.
Khmer Unicode displays on the web, it will always solve now by Google Webfont, please refer to that.
And if you want to have Khmer display in PDF by converting using iText, you can see following post:
Khmer Unicode in iText
http://ask.osify.com/qa/287
They are currently not yet support the display yet.
But, just today I can get it works by modifying the source code of iText (5.5.4-SNAPSHOT) as I just stated in my post: http://ask.osify.com/qa/613, not yet be able to publish since it's just start in testing around.
Updated 13/01/2016
I have added the source code sample for the rendering: http://ask.osify.com/qa/613
The rendering customization with iText for Khmer Unicode added in github: https://github.com/Seuksa/iTextKhmer