Example usage for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDNamedDestination setNamedDestination

List of usage examples for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDNamedDestination setNamedDestination

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDNamedDestination setNamedDestination.

Prototype

public void setNamedDestination(String dest) throws IOException 

Source Link

Document

Set the named destination.

Usage

From source file:org.pdfsam.pdfbox.component.PDFBoxOutlineUtilsTest.java

License:Open Source License

@Test
public void toPageDestinationNamedDestination() throws IOException {
    PDPageFitDestination dest = new PDPageFitDestination();
    dest.setPageNumber(5);//from   w w  w.j a  v a2 s .co m
    PDNamedDestination destination = new PDNamedDestination();
    destination.setNamedDestination("ChuckNorris");
    PDOutlineItem victim = new PDOutlineItem();
    victim.setDestination(destination);
    PDDestinationNameTreeNode names = mock(PDDestinationNameTreeNode.class);
    when(names.getValue("ChuckNorris")).thenReturn(dest);
    assertEquals(5, PDFBoxOutlineUtils.toPageDestination(victim, names).get().getPageNumber());
}