0

When I try to convert PDF document into image and display into Jframe using pdfbox 2.0.7 and the program will generate:

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory exception

Can anybody help me or is there any other PDFbox document viewer rather than image?

Because I have no idea to display PDF rather than converting documents into image and display images into JLabel.

Here is the code... jf.getSelectedFile() is file from JFileChooser:

PDDocument doc = PDDocument.load ( jf.getSelectedFile () );
PDFRenderer d = new PDFRenderer ( doc );
int index = doc.getNumberOfPages ();
for ( int i = 0; i <= index - 1; i ++ ) {
BufferedImage im = d.renderImage ( i , 200 , ImageType.RGB );
ImageIO.write ( im , "jpg" , new File ( "J:\\iTutor Ethiopia\\out put\\image_" + i ) );

The code that display image into JLabel is not writen here.

TT.
  • 15,774
  • 6
  • 47
  • 88
Meshu
  • 35
  • 1
  • 5

0 Answers0