简体   繁体   English

PDFbox的嵌入式字体错误

[英]Embedded font error at PDFbox

I've tried to create a pdf document in java with pdfbox and everything works fine, but when I try to open my pdf I get the message that the embedded font could not be extracted correctly.What could be the reason? 我试图用pdfbox在Java中创建一个pdf文档,但一切正常,但是当我尝试打开pdf时,我收到一条消息,提示无法正确提取嵌入字体。这可能是什么原因?

Here I load my PDfont: 在这里加载我的PDfont:

private PDFont getFont(PDDocument doc) throws IOException {
    return PDTrueTypeFont.loadTTF(doc, "C:\\Windows\\Fonts\\arial.ttf");
}

It seems that the order when PDTrueTypeFont.loadTTF() matters. 似乎PDTrueTypeFont.loadTTF()的顺序PDTrueTypeFont.loadTTF()重要。 After putting it to the beginning of the processing code it started to work in my case. 将其放在处理代码的开头之后,就我而言,它开始起作用。

But some other bugs popped(primarily with text encoding) up so I've switched the library anyway. 但是弹出了其他一些错误(主要是使用文本编码),所以无论如何我都切换了库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM