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 2016/05/30 16:15:13 UTC

[jira] [Updated] (PDFBOX-3368) ContainsKey don't work for he Map returned by PDStructureTreeRoot.getRoleMap

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

Andreas Lehmkühler updated PDFBOX-3368:
---------------------------------------
    Fix Version/s: 2.1.0
                   2.0.2
                   1.8.13

> ContainsKey don't work for he Map<String, Object> returned by PDStructureTreeRoot.getRoleMap
> --------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3368
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3368
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.12, 2.0.1
>         Environment: Windows 10
>            Reporter: Carlos Cabral
>            Assignee: Andreas Lehmkühler
>            Priority: Trivial
>              Labels: patch
>             Fix For: 1.8.13, 2.0.2, 2.1.0
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> No sure if it is an expected behaviour or a bug.
> The Method PDStructureTreeRoot.getRoleMap returns a map which the key is a String (Map<String, Object>).
> However when we use map.containsKey("Header") it always return false because instead of a String it is waiting for A COSName instance.
> Then we have to use  map.containsKey(COSName.getPDFName("Header"));
> In the other the method map.get("Header"); works
> {code:title=Test.java}
> //PDF Filte tested: 
> //http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
> try (PDDocument document = PDDocument.load(new File("PDF32000_2008.pdf"));){
>   PDStructureTreeRoot treeRoot = document.getDocumentCatalog().getStructureTreeRoot();
>   Map<String, Object> roleMap = treeRoot.getRoleMap();
>   //Returned map: COSDictionaryMap<K,V>
>   System.out.println(roleMap.containsKey("Header"));//No work
>   System.out.println(  roleMap.containsKey(COSName.getPDFName("Header")));//Works
> } catch (IOException ex) {  
>   ex.printStackTrace();
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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