You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Atsushi Doita (JIRA)" <ji...@apache.org> on 2018/08/28 09:51:00 UTC

[jira] [Created] (PDFBOX-4302) ToUnicode CMap is not written correctly when the entry count is just 100.

Atsushi Doita created PDFBOX-4302:
-------------------------------------

             Summary: ToUnicode CMap is not written correctly when the entry count is just 100.
                 Key: PDFBOX-4302
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4302
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 2.0.11
         Environment: Windows10
            Reporter: Atsushi Doita
         Attachments: PDFSample.java, pdf_sample.pdf

The following warning log is output when I execute attached PDFSample.java.
org.apache.pdfbox.pdmodel.font.PDFont <init>
WARN: Invalid ToUnicode CMap in font AAKCFF+IPAMincho
org.apache.pdfbox.pdmodel.font.PDType0Font toUnicode
WARN: No Unicode mapping for CID+598 (598) in font AAKCFF+IPAMincho
 :

This program creates a simple japanese pdf and read the image.
This program reads a font file. You can download the file from the following URL.
https://ipafont.ipa.go.jp/old/ipafont/download.html#en

I investigated the problem and found a bug in ToUnicodeWriter class.
In writeTo method, a loop count in a operator is calculated by the following line. But the count will be 0 if the srcFrom size is just 100.
            int count = batch == batchCount - 1 ? srcFrom.size() % 100 : 100;

I changed this line to below and I confirmed that the problem was resolved.
            int count = batch == batchCount - 1 ? srcFrom.size() - 100 * batch : 100;





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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