You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2012/05/18 17:33:06 UTC
[jira] [Closed] (PDFBOX-612) Unknown encoding for 'GBK-EUC-H'
[ https://issues.apache.org/jira/browse/PDFBOX-612?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler closed PDFBOX-612.
-------------------------------------
Resolution: Fixed
Fix Version/s: 1.5.0
Assignee: Andreas Lehmkühler
> Unknown encoding for 'GBK-EUC-H'
> --------------------------------
>
> Key: PDFBOX-612
> URL: https://issues.apache.org/jira/browse/PDFBOX-612
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 0.8.0-incubator
> Environment: Windows
> Reporter: Gang Luo
> Assignee: Andreas Lehmkühler
> Labels: encoding
> Fix For: 1.5.0
>
> Attachments: 1DE9A100d01.pdf, PDFBOX612-1DE9A100d01.txt, PDFBOX612-1DE9A100d011.png
>
>
> Unknown encoding for 'GBK-EUC-H' for chinese pdf document. To fix it.
> 1.add method to org.apache.pdfbox.pdmodel.font.PDFont.java
> public String getEncodingName() {
> COSBase encoding = font.getDictionaryObject(COSName.ENCODING);
> if (encoding != null) {
> if (encoding instanceof COSName) {
> return ((COSName) encoding).getName();
> }
> }
> return null;
> }
> 2.modify encode method.
> from
> if( retval == null && cmap != null )
> {
> retval = cmap.lookup( c, offset, length );
> }
> //if we havn't found a value yet and
> //we are still on the first byte and
> //there is no cmap or the cmap does not have 2 byte mappings then try to encode
> //using fallback methods.
> to
> if( retval == null && cmap != null )
> {
> String encodingStr = getEncodingName();
> if (encodingStr != null) {
> EncodingConverter converter = EncodingConversionManager.getConverter(encodingStr);
> if (converter != null) {
> if (length == 1) return null;
> retval = converter.convertBytes(c, offset, length, cmap);
> } else {
> retval = cmap.lookup( c, offset, length );
> }
> } else {
> retval = cmap.lookup( c, offset, length );
> }
> }
> //if we havn't found a value yet and
> //we are still on the first byte and
> //there is no cmap or the cmap does not have 2 byte mappings then try to encode
> //using fallback methods.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira