I am trying to generate PDF using iText for all locale. It's like PDF can have characters from any languages supported by noto sans and noto sans cjk. I do not know in advance which character may be used in PDF. Itext doesnot give any fallback as well. I decided to merge these two fonts in one. Is it possible?
Here is code snippet I am using to do all this:
public static void generatePDF(String inputFileName, String fileName) throws FileNotFoundException {
OutputStream os = null;
try {
File f = new File(fileName);
os = new BufferedOutputStream(new FileOutputStream(f));
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(new File(inputFileName));
renderer.layout();
renderer.createPDF(os);
} catch(Exception e){
}finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@font-face {
font-family: Noto Serif;
src: url("GoogleNotoSerif-Regular-V1-1.ttf");
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
* {
font-family: Noto Serif;
}
In above code, I want to use font-family name as some common name and that file will be merged as a result of both fonts i.e. Noto Sans and Noto Sans CJK.