Java PFDBox:Can´;t显示PDF中的页面
我想通过PDFBox显示PDF 我发现以下工作代码示例:Java PFDBox:Can´;t显示PDF中的页面,java,pdf,pdfbox,Java,Pdf,Pdfbox,我想通过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 = ne
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();
}
}
});
}
发件人:
它可以与谷歌的Pdf配合使用,但当我使用从Univerity图书馆下载的Springer算法Pdf时,它只显示网站上的图像部分,如:
我得到的信息是:
2015年8月27日凌晨1:51:52 org.apache.pdfbox.util.PDFStreamEngine processOperator
信息:不支持/禁用的操作:ri
问题是:
如何正确显示Springer PDF?您使用哪个Pdfbox版本?ri=渲染意图。这只意味着忽略此运算符。它可能是也可能不是你麻烦的原因。原因只能通过PDF来说明。