Skip to content

Commit 3f1c796

Browse files
Remove tag() method from PdfAnnotation
1 parent b07a840 commit 3f1c796

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/annot/PdfAnnotation.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,6 @@ public PdfDictionary getBorderStyle() {
447447
return getPdfObject().getAsDictionary(PdfName.BS);
448448
}
449449

450-
/**
451-
* Marks annotation to be tagged.
452-
* Normally it shall be done for link annotations.
453-
*
454-
* @return annotation itself.
455-
*/
456-
public PdfAnnotation tag(PdfDocument pdfDocument) {
457-
return put(PdfName.StructParent, new PdfNumber(pdfDocument.getNextStructParentIndex()));
458-
}
459-
460450
public static PdfAnnotation makeAnnotation(PdfObject pdfObject) {
461451
return makeAnnotation(pdfObject, null);
462452
}

kernel/src/main/java/com/itextpdf/kernel/pdf/tagging/PdfObjRef.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ This file is part of the iText (R) project.
4545
package com.itextpdf.kernel.pdf.tagging;
4646

4747
import com.itextpdf.kernel.pdf.PdfDictionary;
48+
import com.itextpdf.kernel.pdf.PdfDocument;
4849
import com.itextpdf.kernel.pdf.PdfName;
50+
import com.itextpdf.kernel.pdf.PdfNumber;
4951
import com.itextpdf.kernel.pdf.annot.PdfAnnotation;
5052

5153
public class PdfObjRef extends PdfMcr {
@@ -61,9 +63,12 @@ public PdfObjRef(PdfAnnotation annot, PdfStructElem parent) {
6163
PdfDictionary parentObject = parent.getPdfObject();
6264
ensureObjectIsAddedToDocument(parentObject);
6365

66+
PdfDocument doc = parentObject.getIndirectReference().getDocument();
67+
annot.getPdfObject().put(PdfName.StructParent, new PdfNumber(doc.getNextStructParentIndex()));
68+
6469
PdfDictionary dict = (PdfDictionary) getPdfObject();
6570
dict.put(PdfName.Type, PdfName.OBJR);
66-
dict.put(PdfName.Obj, annot.tag(parentObject.getIndirectReference().getDocument()).getPdfObject());
71+
dict.put(PdfName.Obj, annot.getPdfObject());
6772
}
6873

6974
@Override

0 commit comments

Comments
 (0)