I cannot figure out how to view a PDF page using PDFBox and its component PDFPagePanel.
So it seems like using PDFBox my options are to either create PDPage list objects or PDDocument objects, but I went with the PDPage list (as opposed to using Splitter()for PDDocument objects)
The following code creates a PDPage object called testPage
File PDF_Path = new File("C:\\PDF.PDF");
PDDocument inputPDF = PDDocument.load(PDF_Path);
List<PDPage> allPages = inputPDF.getDocumentCatalog().getAllPages();
inputPDF.close();
PDPage testPage = (PDPage)allPages.get(0);
From here, I would like to create PDFPagePaneland use its method setPage()to place the PDPage in the component. From here I want to add a component to a JFrame. When I do this, I just see spaces.
JFrame testFrame = new JFrame();
testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
PDFPagePanel pdfPanel = new PDFPagePanel();
pdfPanel.setPage(testPage);
testFrame.add(pdfPanel);
testFrame.setBounds(40, 40, pdfPanel.getWidth(), pdfPanel.getHeight());
testFrame.setVisible(true);
"", PDF , , , , . PDFBox PDFPagePanel PDF?