void setAnnotation(PdfAnnotation annot, PdfIndirectReference currentPage) { PdfArray kArray = getAsArray(PdfName.K); if (kArray == null) { kArray = new PdfArray(); PdfObject k = get(PdfName.K); if (k != null) { kArray.add(k); } put(PdfName.K, kArray); } PdfDictionary dict = new PdfDictionary(); dict.put(PdfName.TYPE, PdfName.OBJR); dict.put(PdfName.OBJ, annot.getIndirectReference()); if (annot.getRole() == PdfName.FORM) dict.put(PdfName.PG, currentPage); kArray.add(dict); }
void setAnnotation(PdfAnnotation annot, PdfIndirectReference currentPage) { PdfArray kArray = getAsArray(PdfName.K); if (kArray == null) { kArray = new PdfArray(); PdfObject k = get(PdfName.K); if (k != null) { kArray.add(k); } put(PdfName.K, kArray); } PdfDictionary dict = new PdfDictionary(); dict.put(PdfName.TYPE, PdfName.OBJR); dict.put(PdfName.OBJ, annot.getIndirectReference()); if (annot.getRole() == PdfName.FORM) dict.put(PdfName.PG, currentPage); kArray.add(dict); }
void addAnnotation(final PdfAnnotation annot) { boolean needToTag = isTagged() && annot.getRole() != null && (!(annot instanceof PdfFormField) || ((PdfFormField)annot).getKids() == null); if (needToTag) { openMCBlock(annot); } writer.addAnnotation(annot); if (needToTag) { PdfStructureElement strucElem = pdf.getStructElement(annot.getId()); if (strucElem != null) { int structParent = pdf.getStructParentIndex(annot); annot.put(PdfName.STRUCTPARENT, new PdfNumber(structParent)); strucElem.setAnnotation(annot, getCurrentPage()); writer.getStructureTreeRoot().setAnnotationMark(structParent, strucElem.getReference()); } closeMCBlock(annot); } }
void addAnnotation(final PdfAnnotation annot) { boolean needToTag = isTagged() && annot.getRole() != null && (!(annot instanceof PdfFormField) || ((PdfFormField)annot).getKids() == null); if (needToTag) { openMCBlock(annot); } writer.addAnnotation(annot); if (needToTag) { PdfStructureElement strucElem = pdf.getStructElement(annot.getId()); if (strucElem != null) { int structParent = pdf.getStructParentIndex(annot); annot.put(PdfName.STRUCTPARENT, new PdfNumber(structParent)); strucElem.setAnnotation(annot, getCurrentPage()); writer.getStructureTreeRoot().setAnnotationMark(structParent, strucElem.getReference()); } closeMCBlock(annot); } }