/** * 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); }
page.setAnnotations(annotations);
void removeWidget( PDAnnotationWidget widget ) throws IOException { PDPage widgetPage = getPage( widget ); List<PDAnnotation> annotations = widgetPage.getAnnotations(); PDAnnotation deleteCandidate = getMatchingCOSObjectable( annotations, widget ); if( deleteCandidate != null && annotations.remove( deleteCandidate ) ) widgetPage.setAnnotations( annotations ); }
page.setAnnotations(annotations);
PDDocument document = PDDocument.loadNonSeq(new File(pdfFilename), null); List<PDPage> pdPages = document.getDocumentCatalog().getAllPages(); for (PDPage pdPage : pdPages) { pdPage.setAnnotations(null); } document.save(new File(...)); document.close();
/** * 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); }
/** * 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); }
private void addLinkToPage(PDPage page, PDAnnotationLink annot) { PDBorderStyleDictionary styleDict = new PDBorderStyleDictionary(); styleDict.setWidth(0); styleDict.setStyle(PDBorderStyleDictionary.STYLE_SOLID); annot.setBorderStyle(styleDict); try { List<PDAnnotation> annots = page.getAnnotations(); if (annots == null) { annots = new ArrayList<PDAnnotation>(); page.setAnnotations(annots); } annots.add(annot); } catch (IOException e) { throw new PdfContentStreamAdapter.PdfException("processLink", e); } }
private void addLinkToPage(PDPage page, PDAnnotationLink annot) { PDBorderStyleDictionary styleDict = new PDBorderStyleDictionary(); styleDict.setWidth(0); styleDict.setStyle(PDBorderStyleDictionary.STYLE_SOLID); annot.setBorderStyle(styleDict); try { List<PDAnnotation> annots = page.getAnnotations(); if (annots == null) { annots = new ArrayList<PDAnnotation>(); page.setAnnotations(annots); } annots.add(annot); } catch (IOException e) { throw new PdfContentStreamAdapter.PdfException("processLink", e); } }
private void addLinkToPage(PDPage page, PDAnnotationLink annot) { PDBorderStyleDictionary styleDict = new PDBorderStyleDictionary(); styleDict.setWidth(0); styleDict.setStyle(PDBorderStyleDictionary.STYLE_SOLID); annot.setBorderStyle(styleDict); try { List<PDAnnotation> annots = page.getAnnotations(); if (annots == null) { annots = new ArrayList<PDAnnotation>(); page.setAnnotations(annots); } annots.add(annot); } catch (IOException e) { throw new PdfContentStreamAdapter.PdfException("processLink", e); } }
page.setAnnotations(newanns); contentStream.close();
page.setAnnotations(annotations);
page.setAnnotations(annotations);
page.setAnnotations(annotations);
page.setAnnotations(annotations);