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

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

     [ https://issues.apache.org/jira/browse/PDFBOX-4302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tilman Hausherr resolved PDFBOX-4302.
-------------------------------------
    Resolution: Fixed
      Assignee: Tilman Hausherr

I added a test that fails with the old code, based on your test code. I used a different font which also fails/{color:#333333}passes{color} the test, but from the same website so we can use the existing download. Thank you again for your effort and your time!

> 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
>            Assignee: Tilman Hausherr
>            Priority: Minor
>             Fix For: 2.0.12, 3.0.0 PDFBox
>
>         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