Hi,
I want to covert html to pdf using Aspose.PDF. I specify “Noto Sans SC” in html and this font is for Chinese and it’s otf not ttf. After coverting, it said that this font has been embeded. But I open this pdf with Adobe Acrobat Reader DC, word can’t be display normally. Can’ t we embed otf font into pdf?
here is my code:
FileInputStream fileInputStream = new FileInputStream("C:\\Users\\xxx\\Desktop\\Aspose-Total-Java.lic");
License license = new License();
license.setLicense(fileInputStream);
String out = "C:\\Users\\Lucy Hao\\Desktop\\12345.pdf";
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
FontRepository.loadFonts();
InputStream inputStream = new FileInputStream("C:\\Users\\xxx\\Desktop\\1234.html");
Document document = new Document(inputStream, htmlLoadOptions);
document.save(out);
// check pdf font
Document pdfDocument = new Document(out);
for (Page page : pdfDocument.getPages()) {
page.getResources().getFonts().forEach(font -> {
System.out.println(font.getFontName() + ":" + font.isEmbedded() + "," + font.isSubset());
});
}
this is log result:
NotoSansSC:true,false
this is html and pdf file:
testfont.zip (7.0 MB)
In Adobe Acrobat Reader DC, words cn’t display normally
111.JPG.png (37.5 KB)