public void writeOutline(PDFOutline outline) { List <PDFDestination> roots = outline.getRootDestinations(); beginObject(outline.getId()); println(" << /Type /Outlines"); println(" /First " + roots.get(0).getId() + " 0 R"); println(" /Last " + roots.get(roots.size() - 1).getId() + " 0 R"); println(" >>"); endObject(); for (int i = 0; i < roots.size(); i++) { writeOutlineItem(roots, i); } }
public int add_page_to_outline(String title, double pos, int parentId) { if (_outline == null) { int outlineId = _out.allocateId(1); _outline = new PDFOutline(outlineId); } int id = _out.allocateId(1); PDFDestination dest = new PDFDestination(id, title, _page.getId(), pos); _outline.addDestination(dest, parentId); return(id); }