I'm trying to use thymeleaf and flyingsaucer to generate pdf from html-template. thymeleaf fills template and flyingsaucer create pdf-file. I'm using cyrillic font in template, but after generate pdf-file is empty.
Code
ITextFontResolver fontResolver = renderer.getFontResolver(); ClassPathResource regular = new ClassPathResource("fonts/arial.ttf"); fontResolver.addFont(regular.getURL().toString(), BaseFont.IDENTITY_H, true);
is working great, but I want to avoid this approach. So, I tried to use approach like in this example stackoverflow.com/questions/7525403/how-to-embed-font-in-pdf-created-from-html-with-itext-and-flying-saucer but it doesnt work in my case.
My html-style section:
@font-face { font-family: 'Arial Serif'; src: url('../fonts/arial.ttf'); -fs-pdf-font-embed: embed; -fs-pdf-font-encoding: Identity-H; }
and the body-tag:
body style="font-family: 'Arial Serif'"
Tell me, please, where is I've made mistake.
I'm trying to use thymeleaf and flyingsaucer to generate pdf from html-template. thymeleaf fills template and flyingsaucer create pdf-file. I'm using cyrillic font in template, but after generate pdf-file is empty. Code
ITextFontResolver fontResolver = renderer.getFontResolver(); ClassPathResource regular = new ClassPathResource("fonts/arial.ttf"); fontResolver.addFont(regular.getURL().toString(), BaseFont.IDENTITY_H, true);
is working great, but I want to avoid this approach. So, I tried to use approach like in this example stackoverflow.com/questions/7525403/how-to-embed-font-in-pdf-created-from-html-with-itext-and-flying-saucer but it doesnt work in my case. My html-style section:@font-face { font-family: 'Arial Serif'; src: url('../fonts/arial.ttf'); -fs-pdf-font-embed: embed; -fs-pdf-font-encoding: Identity-H; }
and the body-tag:body style="font-family: 'Arial Serif'"
Tell me, please, where is I've made mistake.