gpt4 book ai didi

java - 在java中读取使用iText创建的pdf文件

转载 作者:行者123 更新时间:2023-12-01 11:45:29 25 4
gpt4 key购买 nike

我正在使用 iText 库使用 java 创建 pdf 文件,该文件已创建并使用 adobe 打开,但是当我尝试阅读它时,我得到 java.io.FileNotFoundException: ErRecord.pdf (系统找不到指定文件)

FileInputStream input = null;
File file = new File("ErRecord.pdf");
System.out.println(file.canRead());
input = new FileInputStream(file);

file.canRead() 返回 false,有没有办法读取文件或使用 iText 使其可读?

最佳答案

我使用了 getAbsoluteFile() 并且路径错误..我只是使用绝对路径

文件 file = new File("c:/Users/rawan/workspace-luna/Prototype_3/ErRecord.pdf");

效果很好

关于java - 在java中读取使用iText创建的pdf文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29173630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com