/** * Update the StructParents and StructParent values in a PDPage. * * @param page the new page * @param structParentOffset the offset which should be applied */ private void updateStructParentEntries(PDPage page, int structParentOffset) throws IOException { if (page.getStructParents() >= 0) { page.setStructParents(page.getStructParents() + structParentOffset); } List<PDAnnotation> annots = page.getAnnotations(); List<PDAnnotation> newannots = new ArrayList<>(); for (PDAnnotation annot : annots) { if (annot.getStructParent() >= 0) { annot.setStructParent(annot.getStructParent() + structParentOffset); } newannots.add(annot); } page.setAnnotations(newannots); }
/** * Update the StructParents and StructParent values in a PDPage. * * @param page the new page * @param structParentOffset the offset which should be applied */ private void updateStructParentEntries(PDPage page, int structParentOffset) throws IOException { page.setStructParents(page.getStructParents() + structParentOffset); List<PDAnnotation> annots = page.getAnnotations(); List<PDAnnotation> newannots = new ArrayList<>(); for (PDAnnotation annot : annots) { annot.setStructParent(annot.getStructParent() + structParentOffset); newannots.add(annot); } page.setAnnotations(newannots); }
/** * Update the StructParents and StructParent values in a PDPage. * * @param page the new page * @param structParentOffset the offset which should be applied */ private void updateStructParentEntries(PDPage page, int structParentOffset) throws IOException { page.setStructParents(page.getStructParents() + structParentOffset); List<PDAnnotation> annots = page.getAnnotations(); List<PDAnnotation> newannots = new ArrayList<PDAnnotation>(); for (PDAnnotation annot : annots) { annot.setStructParent(annot.getStructParent() + structParentOffset); newannots.add(annot); } page.setAnnotations(newannots); }