@Test public void copyDictionary() { PDOutlineItem from = new PDOutlineItem(); from.setBold(true); from.setItalic(true); from.setTitle("Chuck"); PDOutlineItem to = new PDOutlineItem(); to.setBold(false); to.setItalic(false); OutlineUtils.copyOutlineDictionary(from, to); assertTrue(to.isBold()); assertTrue(to.isItalic()); assertEquals("Chuck", to.getTitle()); assertNull(to.getCOSObject().getDictionaryObject(COSName.C)); }
public static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to) { to.setTitle(defaultString(from.getTitle())); if (nonNull(from.getCOSObject().getDictionaryObject(COSName.C, COSArray.class))) { to.setTextColor(from.getTextColor()); } to.setBold(from.isBold()); to.setItalic(from.isItalic()); if (from.isNodeOpen()) { to.openNode(); } else { to.closeNode(); } }
OutlineUtils { public static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to) { to.setTitle(defaultString(from.getTitle())); if (nonNull(from.getCOSObject().getDictionaryObject(COSName.C, COSArray.class))) { to.setTextColor(from.getTextColor()); } to.setBold(from.isBold()); to.setItalic(from.isItalic()); if (from.isNodeOpen()) { to.openNode(); } else { to.closeNode(); } } }
OutlineUtils { public static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to) { to.setTitle(defaultString(from.getTitle())); if (nonNull(from.getCOSObject().getDictionaryObject(COSName.C, COSArray.class))) { to.setTextColor(from.getTextColor()); } to.setBold(from.isBold()); to.setItalic(from.isItalic()); if (from.isNodeOpen()) { to.openNode(); } else { to.closeNode(); } } private  OutlineUtils(); }
OutlineUtils { public static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to) { to.setTitle(defaultString(from.getTitle())); if (nonNull(from.getCOSObject().getDictionaryObject(COSName.C, COSArray.class))) { to.setTextColor(from.getTextColor()); } to.setBold(from.isBold()); to.setItalic(from.isItalic()); if (from.isNodeOpen()) { to.openNode(); } else { to.closeNode(); } } private  OutlineUtils(); static Set<Integer> getOutlineLevelsWithPageDestination(PDDocument document); static Optional<PDPageDestination> toPageDestination(PDOutlineItem current, PDDocumentCatalog catalog); static PDPageXYZDestination pageDestinationFor(PDPage page); static PDPageDestination clonePageDestination(PDPageDestination dest, PDPage destPage); static PDPage resolvePageDestination(PDPageDestination destination, PDDocument document); static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to); static List<OutlineItem> getFlatOutline(PDDocument document); static void printOutline(PDDocument document); }
OutlineUtils { public static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to) { to.setTitle(defaultString(from.getTitle())); if (nonNull(from.getCOSObject().getDictionaryObject(COSName.C, COSArray.class))) { to.setTextColor(from.getTextColor()); } to.setBold(from.isBold()); to.setItalic(from.isItalic()); if (from.isNodeOpen()) { to.openNode(); } else { to.closeNode(); } } private  OutlineUtils(); static Set<Integer> getOutlineLevelsWithPageDestination(PDDocument document); static Optional<PDPageDestination> toPageDestination(PDOutlineItem current, PDDocumentCatalog catalog); static PDPageXYZDestination pageDestinationFor(PDPage page); static PDPageDestination clonePageDestination(PDPageDestination dest, PDPage destPage); static PDPage resolvePageDestination(PDPageDestination destination, PDDocument document); static void copyOutlineDictionary(PDOutlineItem from, PDOutlineItem to); static List<OutlineItem> getFlatOutline(PDDocument document); static void printOutline(PDDocument document);  }