[英]Check if fonts are embedded in an existing PDF?
How can I check if the fonts
are embedded in an existing PDF
? 如何检查
fonts
是否已嵌入现有的PDF
?
That is, read an existing PDF
and list out the results in a .txt
file 也就是说,阅读现有的
PDF
并将结果列在.txt
文件中
I went through the following example: 我经历了以下示例:
http://itextpdf.com/examples/iia.php?id=287 http://itextpdf.com/examples/iia.php?id=287
The above example tries to create a new PDF , but I want to read a PDF
file and check if the fonts are embedded or not. 上面的示例尝试创建一个新的PDF ,但是我想读取一个
PDF
文件并检查字体是否嵌入。
I am more of a PHP
guy so having a hard time to tweak the code. 我更像是一个
PHP
所以很难调整代码。 Any help would be appreciated 任何帮助,将不胜感激
I am not sure what I have done is correct. 我不确定我所做的是正确的。 Based on the suggestion by Bruno,
根据布鲁诺的建议,
I actually removed the dependency of that FontTypes
package itself. 实际上,我删除了那个
FontTypes
包本身的依赖项。
Instead created a new variable public static final String PREFACE = "resources/pdfs/sample.pdf";
而是创建一个新的变量
public static final String PREFACE = "resources/pdfs/sample.pdf";
//Path of Existing PDF File //现有PDF文件的路径
And Passed the PREFACE
to the main method 并将
PREFACE
传递给main方法
public static void main(String[] args) throws IOException, DocumentException {
Set<String> set = new ListUsedFonts().listFonts(PREFACE);
PrintWriter out = new PrintWriter(new FileOutputStream(RESULT));
for (String fontname : set)
out.println(fontname);
out.flush();
out.close();
}
But I did get the output in the form fonts.txt
但是我确实以
fonts.txt
的形式获得了输出
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.