Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
2.0.22
-
None
-
None
-
Windows 10
Description
I tried to change PDF file including Chinese font to JPG file.
Source code is as below.
private List<String> convertPdf2Jpg(File pdfFile) { List<String> jpgList = new ArrayList<String>(); try { PDDocument document = PDDocument.load(pdfFile); PDFRenderer pdfRenderer = new PDFRenderer(document); for (int i = 0; i < document.getNumberOfPages(); i++) { BufferedImage image = null; try{ image = pdfRenderer.renderImageWithDPI(i, 300 ,ImageType.RGB); String jpgName = pdfFile.getPath().split(".pdf")[0] + "_" + String.format("%03d", i+1) + ".jpg"; ImageIOUtil.writeImage(image, jpgName, 300); jpgList.add(jpgName); } catch(Exception e) { document.close(); LOG.error(pdfFile + "(" + i + " page) " + " can't convert pdf to jpg file (convertPdf2Jpg())." + e.toString()); throwPdfBoxException("convertPdf2Jpg():" + pdfFile + "(" + i + " page) " + " can't convert pdf to jpg file." + e.toString()); } } document.close(); } catch(Exception e){ LOG.error(pdfFile + "Can't load PDF file (convertPdf2Jpg())."); } return jpgList; }
I attached example of PDF and JPG. Chinese characters are broken.
It seems that it depends on font.
If you need more information, please let me know.
Thanks
//Okada
Attachments
Attachments
Issue Links
- duplicates
-
PDFBOX-3293 Chinese font glyphs with overlapping paths not rendered correctly
- Open