This was removed in 2.0 because it made trouble. Obviously, it doesn't work for 1.8 either, at least for you, so why bother?

There are two ways to display, either get a BufferedImage (renderImage / renderImageWithDPI) and display that somehow (see in PDFDebugger how to do it), or renderPageToGraphics which renders to a graphics device object.

If you really want to get the source code of the deleted PDFReader application (which includes PDFPagePanel), use svn to get revision 1702125 or earlier, that should have it. But if it didn't work for you in 1.8, it won't work for you now.

The point is that swing display of PDF pages isn't part of the API, it's part of some tool (now: in PDFDebugger, previously: in PDFReader)

You need to have some understanding of awt / swing. If you don't, learn it, or hire somebody. (That's what we did, and the best is: google paid it, as part of the google summer of code)

Tilman

PS: when the page is blank, make sure to look for any log output texts about missing libraries.



Am 22.12.2015 um 02:05 schrieb Joshua Aroke:
Hi guys.
Thanks for the good job done on Apache PDFBox
However, checking the version 2.0 change log at http://pdfbox
.apache.org/2.0/migration.html , I found out nothing was mentioned about
*PDFPagePanel* class which use to be on version 1.8 as I have in the API
doc of 1.8. Please do mail me an update on this as this is the first time
I'm using this Library. For now, I may have to download the stable version
1.8

However in 1.8 I am experiencing an issue displaying pdf. I have these
lines of codes that I have being trying to use to read pdf file with Apache
pdfBox.

private void readPdf(){
     try {
         File PDF_Path = new File("/home/olyjosh/Downloads/my project.pdf");
         PDDocument inputPDF = PDDocument.load(PDF_Path);
         List<PDPage> allPages = inputPDF.getDocumentCatalog().getAllPages();
         PDPage testPage = (PDPage) allPages.get(5);
         System.out.println("Number of pages "+allPages.size());

         PDFPagePanel pdfPanel = new PDFPagePanel();
         jPanel1.add(pdfPanel);
         pdfPanel.setPage(testPage);

//            this.revalidate();
         inputPDF.close();
     } catch (IOException ex) {
         Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, 
ex);
     }
}

I want this pdf to be displayed on swing component like jPanel but this
will only display the panel without the expected content of the pdf file(
It went blank, just white pane displayed)

Best Regards



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to