0
嗨,大家好,我想創建一個PDF閱讀器將讀取console.I一個硬編碼的PDF和打印數據已經用下面的代碼..PDF閱讀器打印在控制檯中使用的Java
public class pdfreader {
public static void main(String args[]) throws Exception {
readResourceFileAndPrintContents();
}
private static void readResourceFileAndPrintContents() throws Exception {
InputStream stream = loadResourceAsStream("/home/ajay/Downloads/Beginning iPhone Development.pdf");
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
String line;
while ((line = in.readLine()) != null) {
System.out.println((line));
}
}
public static InputStream loadResourceAsStream(final String resourceName) {
InputStream input = null;
try {
input = new FileInputStream(resourceName);
} catch (FileNotFoundException e) {
System.out.println("Resource File Not Found");
e.printStackTrace();
}
return input;
}
}
但我沒有得到上下文。 你能幫我嗎..謝謝。