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: answered Sep 19 2014 at 22:55 |
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 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: answered Sep 20 2014 at 00:39 |
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 . 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 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: answered Sep 20 2014 at 00:59 |
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: answered Sep 20 2014 at 01:39 |
Hi Tilman Very appreciate for the help, finally able to generate the image but jvm having warning as below : 17:30:18,825 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (1) in font VRQGOC+TTE22F6270t00 17:30:18,826 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (2) in font VRQGOC+TTE22F6270t00 17:30:18,826 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (3) in font VRQGOC+TTE22F6270t00 17:30:18,827 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (4) in font VRQGOC+TTE22F6270t00 17:30:18,828 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (5) in font VRQGOC+TTE22F6270t00 17:30:18,829 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (6) in font VRQGOC+TTE22F6270t00 17:30:18,830 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (7) in font VRQGOC+TTE22F6270t00 17:30:18,831 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (8) in font VRQGOC+TTE22F6270t00 17:30:18,832 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (9) in font VRQGOC+TTE22F6270t00 17:30:18,834 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (20) in font WQJOPO+TTE1714AF0t00 17:30:18,836 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (21) in font WQJOPO+TTE1714AF0t00 17:30:18,837 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (22) in font WQJOPO+TTE1714AF0t00 17:30:18,838 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (23) in font WQJOPO+TTE1714AF0t00 17:30:18,841 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (24) in font WQJOPO+TTE1714AF0t00 17:30:18,842 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (25) in font WQJOPO+TTE1714AF0t00 17:30:18,844 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (26) in font WQJOPO+TTE1714AF0t00 17:30:18,847 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (27) in font WQJOPO+TTE1714AF0t00 17:30:18,850 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (28) in font WQJOPO+TTE1714AF0t00 17:30:18,852 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (29) in font WQJOPO+TTE1714AF0t00 17:30:18,855 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (30) in font WQJOPO+TTE1714AF0t00 17:30:18,855 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (31) in font WQJOPO+TTE1714AF0t00 Do you have any idea for this ? Thanks, Jason 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: answered Sep 20 2014 at 02:34 |
Hi, This means there's a problem with the font, but if the file renders correctly you don't have to bother. If the file doesn't render correctly, then please open an issue in JIRA and attach the PDF. Tilman Am 20.09.2014 um 11:34 schrieb Jason Hue: answered Sep 20 2014 at 02:40 |
Hi Tilman, After checking back the generated image, some table line is missing and the warning code appeared in JVM as below : 17:36:01,519 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (14) in font WWOOUG+TTE18A2190t00 17:36:01,520 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (12) in font WWOOUG+TTE18A2190t00 17:36:01,521 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (18) in font WWOOUG+TTE18A2190t00 17:36:01,521 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (22) in font WWOOUG+TTE18A2190t00 17:36:01,522 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (27) in font WWOOUG+TTE18A2190t00 17:36:01,522 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (11) in font WWOOUG+TTE18A2190t00 17:36:01,523 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (26) in font WWOOUG+TTE18A2190t00 17:36:01,523 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (30) in font WWOOUG+TTE18A2190t00 17:36:01,524 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (15) in font WWOOUG+TTE18A2190t00 17:36:01,524 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (21) in font WWOOUG+TTE18A2190t00 17:36:01,525 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (16) in font WWOOUG+TTE18A2190t00 17:36:01,525 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (29) in font WWOOUG+TTE18A2190t00 17:36:01,526 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,526 WARN [org.apache.pdfbox.rendering.font.TTFGlyph2D] (taskExecutor-3) No glyph for 77 in font BWRIIR+TTE1898178t00 17:36:01,526 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,527 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,527 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,528 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,528 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,529 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,529 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,529 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,530 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (20) in font WWOOUG+TTE18A2190t00 17:36:01,531 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,531 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,532 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,533 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,533 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,534 WARN [org.apache.pdfbox.pdmodel.font.PDTrueTypeFont] (taskExecutor-3) Can't map code 77 in font BWRIIR+TTE1898178t00 17:36:01,539 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-3) No Unicode mapping for .notdef (17) in font WWOOUG+TTE18A2190t00 Any idea for this ? Best Regards, Jason Hi Tilman Very appreciate for the help, finally able to generate the image but jvm having warning as below : 17:30:18,825 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (1) in font VRQGOC+TTE22F6270t00 17:30:18,826 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (2) in font VRQGOC+TTE22F6270t00 17:30:18,826 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (3) in font VRQGOC+TTE22F6270t00 17:30:18,827 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (4) in font VRQGOC+TTE22F6270t00 17:30:18,828 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (5) in font VRQGOC+TTE22F6270t00 17:30:18,829 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (6) in font VRQGOC+TTE22F6270t00 17:30:18,830 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (7) in font VRQGOC+TTE22F6270t00 17:30:18,831 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (8) in font VRQGOC+TTE22F6270t00 17:30:18,832 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (9) in font VRQGOC+TTE22F6270t00 17:30:18,834 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (20) in font WQJOPO+TTE1714AF0t00 17:30:18,836 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (21) in font WQJOPO+TTE1714AF0t00 17:30:18,837 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (22) in font WQJOPO+TTE1714AF0t00 17:30:18,838 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (23) in font WQJOPO+TTE1714AF0t00 17:30:18,841 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (24) in font WQJOPO+TTE1714AF0t00 17:30:18,842 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (25) in font WQJOPO+TTE1714AF0t00 17:30:18,844 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (26) in font WQJOPO+TTE1714AF0t00 17:30:18,847 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (27) in font WQJOPO+TTE1714AF0t00 17:30:18,850 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (28) in font WQJOPO+TTE1714AF0t00 17:30:18,852 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (29) in font WQJOPO+TTE1714AF0t00 17:30:18,855 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (30) in font WQJOPO+TTE1714AF0t00 17:30:18,855 WARN [org.apache.pdfbox.pdmodel.font.PDSimpleFont] (taskExecutor-1) No Unicode mapping for .notdef (31) in font WQJOPO+TTE1714AF0t00 Do you have any idea for this ? Thanks, Jason 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: answered Sep 20 2014 at 02:42 |
Hi, The missing lines may be a resolution related issue, there are several JITA issues about this. Try rendering at 300dpi and see if it is there. The "No Unicode mapping" means there's a problem with the font, but if the glyphs render correctly you don't have to bother. Tilman Am 20.09.2014 um 11:42 schrieb Jason Hue: answered Sep 20 2014 at 02:59 |
Hi Tilman, Thank you very much. It working perfect now after change dpi to 300. :) Thanks, Jason Hi, The missing lines may be a resolution related issue, there are several JITA issues about this. Try rendering at 300dpi and see if it is there. The "No Unicode mapping" means there's a problem with the font, but if the glyphs render correctly you don't have to bother. Tilman Am 20.09.2014 um 11:42 schrieb Jason Hue: answered Sep 20 2014 at 03:07 |
Group Pdfbox-users
asked Sep 19 2014 at 20:05
active Sep 20 2014 at 03:07
posts:10
users:2