pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: pdfbox-2.0.0-RC1 throws IOException: Invalid characters codes in linux but works fine in windows
Date Thu, 29 Oct 2015 17:06:10 GMT
Hi,


Am 29.10.2015 um 11:03 schrieb 郭峰:
> *I am using pdfbox to convert pdf to image. When I  convert the pdf file which
> is in the attachment, it throws IOException: Invalid characters codes:*
Your file didn't make it due to some restrictions to the mailing list, but I got 
a hand on it as your post went through the moderation queue.

It looks like your problem is related to PDFBOX-2950 [1]

BR
Andreas

[1] https://issues.apache.org/jira/browse/PDFBOX-2950

>
> java.io.IOException: Invalid characters codes
> at org.apache.fontbox.ttf.CmapSubtable.processSubtype12(CmapSubtable.java:237)
> at org.apache.fontbox.ttf.CmapSubtable.initSubtable(CmapSubtable.java:107)
> at org.apache.fontbox.ttf.CmapTable.read(CmapTable.java:84)
> at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
> at org.apache.fontbox.ttf.TrueTypeFont.getCmap(TrueTypeFont.java:282)
> at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmap(TrueTypeFont.java:524)
> at org.apache.fontbox.ttf.TrueTypeFont.nameToGID(TrueTypeFont.java:582)
> at org.apache.fontbox.ttf.TrueTypeFont.getWidth(TrueTypeFont.java:644)
> at
> org.apache.pdfbox.pdmodel.font.PDCIDFontType0.getWidthFromFont(PDCIDFontType0.java:372)
> at org.apache.pdfbox.pdmodel.font.PDType0Font.getWidthFromFont(PDType0Font.java:382)
> at org.apache.pdfbox.rendering.PageDrawer.drawGlyph2D(PageDrawer.java:349)
> at org.apache.pdfbox.rendering.PageDrawer.showFontGlyph(PageDrawer.java:324)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.showGlyph(PDFStreamEngine.java:735)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.showText(PDFStreamEngine.java:692)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.showTextString(PDFStreamEngine.java:560)
> at org.apache.pdfbox.contentstream.operator.text.ShowText.process(ShowText.java:50)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:806)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:468)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:442)
> at
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
> at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:179)
> at org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
> at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
> at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:80)
>
> *here is my test code:*
>
>      private static void pdfToImage(String filePath, String filename)
>              throws IOException {
>          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.renderImageWithDPI(i, 300);
>              File imageFile = new File(filePath + File.separator
>                      + FilenameUtils.getBaseName(filename) + File.separator
>                      + FilenameUtils.getBaseName(filename) + "_" + count++
>                      + ".jpg");
>              imageFile.mkdirs();
>              ImageIO.write(image, "jpg", imageFile);
>          }
>      }
>
> *please give me some help, thanks!*
> *
> *
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message