我想通过PDFBox显示PDF。
我发现这个代码示例:
public static void openPDF() throws IOException{
//Locate File
File PDF_Path = new File("C:\\Algo-Book.pdf");
final PDDocument inputPDF = PDDocument.load(PDF_Path);
//Get Page
PDFPagePanel pdf = new PDFPagePanel();
pdf.setPage((PDPage) inputPDF.getPrintable(100));
final JFrame theFrame = new JFrame();
theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
theFrame.add(pdf);
theFrame.setBounds(40, 40, pdf.getWidth(), pdf.getHeight());
theFrame.setVisible(true);
theFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
try {
inputPDF.close();
theFrame.setVisible(false);
} catch (IOException e1) {
// TODO: implement error handling
e1.printStackTrace();
}
}
});
}
自: How to view a PDF document using PDFBox's PDFPagePanel
它适用于谷歌的Pdf,但当我使用Springer的算法PDF,我从大学图书馆下载它只显示网站上的图片部分,如:
我得到了信息:
2015年8月27日上午1:51:52 org.apache.pdfbox.util.PDFStreamEngine processOperator 信息:不支持/禁用操作:ri
问题是: 如何正确显示Springer PDF?