pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilad Denneboom <gilad.denneb...@gmail.com>
Subject Add new Named Dest to file
Date Tue, 20 Nov 2012 19:21:05 GMT
Hi people,

Another query here... I'm trying to add a new named destination to a file,
but for some reason it doesn't show up...

Here's the relevant piece of code I'm using for it:

        PDDestinationNameTreeNode dests =
doc.getDocumentCatalog().getNames().getDests();

        PDPageXYZDestination d = new PDPageXYZDestination();
        d.setLeft(500);
        d.setTop(500);
        d.setPageNumber(0);

        Map<String, Object> destList = dests.getNames();
        Map<String, COSObjectable> newList = new HashMap<String,
COSObjectable>();

        Iterator<String> it = destList.keySet().iterator();
        while(it.hasNext()) {
            String key = it.next();
            System.out.println(key);
            System.out.println(destList.get(key));
            newList.put(key, (COSObjectable)destList.get(key));
        }
        newList.put("1", d);
        dests.setNames(newList);

Does anyone see any obvious problems, or am I going at it the wrong way?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message