I'm trying to use the pdf library from jpedal, using the code snippet found here: http://www.jpedal.org/simple_image_example.php
/**instance of PdfDecoder to convert PDF into image*/
PdfDecoder decode_pdf = new PdfDecoder(true);
/**set mappings for non-embedded fonts to use*/
FontMappings.setFontReplacements();
/**open the PDF file - can also be a URL or a byte array*/
try {
decode_pdf.openPdfFile("C:/myPDF.pdf"); //file
//decode_pdf.openPdfFile("C:/myPDF.pdf", "password"); //encrypted file
//decode_pdf.openPdfArray(bytes); //bytes is byte[] array with PDF
//decode_pdf.openPdfFileFromURL("http://www.mysite.com/myPDF.pdf",false);
/**get page 1 as an image*/
//page range if you want to extract all pages with a loop
//int start = 1, end = decode_pdf.getPageCount();
BufferedImage img=decode_pdf.getPageAsImage(1);
/**close the pdf file*/
decode_pdf.closePdfFile();
} catch (PdfException e) {
e.printStackTrace();
}
But on this line:
decode_pdf.openPdfFile("C:/myPDF.pdf"); //file
Eclipse trows an error:
The type javax.swing.JPanel cannot be resolved. It is indirectly referenced from required .class files
It seems as if I'm missing javax.swing.*
Intellisence does give me other javax.* options but not the swing class.
I already searched google for this but I had no luck finding a solution.
Any ideas?
Can't get any clearer than this: http://www.jpedal.org/PDFblog/2011/09/java-is-not-android/
Appears that the library I wanted to use was not compatible with android at all.
Also not the last sentence:
that makes converting a Java PDF viewer to Android a major task.
Thanks for crushing that last bit of hope for me jpedal...
我怀疑路径没有解决,请尝试
decode_pdf.openPdfFile("C:\\myPDF.pdf");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.