i can open a PDF as img in a JFrame, no problem, but i will not open a new Window for it, the PDF must be shown in a jInternalFrame.
I create with Netbeans a Design and will open the Document with following code:
(Apache PDFBox)
public void openFile(){
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
File file = new File("/home/ritzmo/Labor_Clotten/PDF_Befunde/test.pdf");
PDDocument pdffile = Loader.loadPDF(file);
PDFRenderer pdfRenderer = new PDFRenderer(pdffile);
BufferedImage image = pdfRenderer.renderImage(0);
JLabel label = new JLabel(new ImageIcon(image));
jInternalFrame2.setTitle("PDF G");
jInternalFrame2.add(new JScrollPane(label));
jInternalFrame2.setVisible(true);
} catch (IOException e) {
}
}
});
}
The jInternalFrame lies on the Main JFrame, but the PDF will not be shown.
I search on google, chatgpt over 3 hours but found no answers.
Anybody have an idea?
Greats Moritz
The Program start with no errors.
I search on chatgpt and google over 3 hours but found no answers.
Anybody have an idea?
Moritz Müller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.