You probably used only pdfbox.jar. Also use fontbox and xmpbox.
Alternatively, use pdfbox-app only.
Depending on what pdf files you have, you may also need the levigo JBIG2
jar file (google for it).
Tilman
Am 20.09.2014 um 09:59 schrieb Jason Hue:
Hi,
i encounter error
java.lang.NoClassDefFoundError:org/apache/fontbox/ttf/Type1Equivalent
if using
BufferedImage image = renderer.renderImage(i, 1);
then i change to BufferedImage image = renderer.renderImageWithDPI(i, 96);
facing different error as below :
java.lang.NoClassDefFoundError: org/apache/fontbox/ttf/TTFParser
Appreciate for any advice.
Best Regards,
Jason
.
On Saturday, September 20, 2014 3:39 PM, Jason Hue
<[email protected]> wrote:
Hi,
I having error as below :
java.lang.NoClassDefFoundError: org/apache/fontbox/ttf/Type1Equivalent
below is my code :
String fullPath = filePath + filename;
File pdfFile =new File(fullPath);
PDDocument document = null;
document = PDDocument.load(pdfFile);
PDFRenderer renderer = new PDFRenderer(document);
int numPages = document.getNumberOfPages();
int count = 1;
for (int i = 0; i < numPages; i++)
{
BufferedImage image = renderer.renderImage(i, 1);
File imageFile = new File( filePath + File.separator +
FilenameUtils.getBaseName(filename) + File.separator + FilenameUtils.getBaseName(filename) +
"_" + count++ + ".jpg" );
imageFile.mkdirs();
ImageIO.write(image, "jpg",imageFile);
}
Appreciate for any solution.
Best Regards,
Jason Hue
On Saturday, September 20, 2014 1:55 PM, Tilman Hausherr
<[email protected]> wrote:
new PDFRenderer(document).renderImage() or renderImageWithDPI()
Download the source code and look at the examples and at the tests
Enjoy!
Tilman
Am 20.09.2014 um 05:05 schrieb Jason Hue:
Hi,
May i know how to convert PDF to Image using PDFBOX 2.0.0 ?
Thanks,
Jason