Hi,

Hmm... I haven't tested your code, but I wonder why root.getOpenCount() always gets negative numbers (= closed), and outline positive ones ( = open)?

What you could also try is to attach this to a PDF, and then test that one with preflight-app and with http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx . Both do also check the outlines, even if it isn't a valid pdf/a.

document.getDocumentCatalog().setDocumentOutline(outline)

Tilman


Am 09.02.2015 um 18:52 schrieb Andrea Vacondio:
Hi,
I'm playing with the outline package and I' trying to figure out if my
understanding of the spec tables 152 and 153, Count key for the outline
dictionary and outline item dictionary is correct. Could someone confirm
that the following units should pass?
Thanks

@Test
     public void outlinesCount()
     {
         PDDocumentOutline outline = new PDDocumentOutline();
         PDOutlineItem root = new PDOutlineItem();
         outline.appendChild(root);
         assertEquals(1, outline.getOpenCount());
         root.appendChild(new PDOutlineItem());
         assertEquals(-1, root.getOpenCount());
         assertEquals(1, outline.getOpenCount());
         root.appendChild(new PDOutlineItem());
         assertEquals(-2, root.getOpenCount());
         assertEquals(1, outline.getOpenCount());
         root.openNode();
         assertEquals(2, root.getOpenCount());
         assertEquals(3, outline.getOpenCount());
     }

  @Test
     public void multipleLevelsCount()
     {
         PDOutlineItem root = new PDOutlineItem();
         PDOutlineItem first = new PDOutlineItem();
         root.appendChild(first);
         assertEquals(-1, root.getOpenCount());
         PDOutlineItem second = new PDOutlineItem();
         root.appendChild(second);
         assertEquals(-2, root.getOpenCount());
         second.appendChild(new PDOutlineItem());
         assertEquals(-1, second.getOpenCount());
         assertEquals(-2, root.getOpenCount());
         second.openNode();
         assertEquals(1, second.getOpenCount());
         assertEquals(-3, root.getOpenCount());
         root.openNode();
         assertEquals(3, root.getOpenCount());
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to