### Question:
OFDDoc implements Closeable { public OFDDoc addAnnotation(int pageNum, Annotation annotation) throws IOException { if (annotation == null) { return this; } if (reader == null) { throw new RuntimeException("仅在修改模式下允许获取追加注释对象，请使用reader构造"); } if (annotationRender == null) { annotationRender = new AnnotationRender(reader.getOFDDir().obtainDocDefault(), prm, MaxUnitID); } PageInfo pageInfo = reader.getPageInfo(pageNum); annotationRender.render(pageInfo, annotation); return this; } OFDDoc(Path outPath);  OFDDoc(OFDReader reader, Path outPath); private  OFDDoc(); OFDDoc setDefaultPageLayout(PageLayout pageLayout); OFDDoc add(Div item); OFDDoc addVPage(VirtualPage virtualPage); AdditionVPage getAVPage(int pageNum); OFDDoc addAnnotation(int pageNum, Annotation annotation); PageLayout getPageLayout(); OFDDoc addAttachment(Attachment attachment); @Override void close();  }### Answer:
@Test void addAnnotationStamp() throws IOException, DocumentException { Path srcP = Paths.get("src/test/resources", "AddWatermarkAnnot.ofd"); Path outP = Paths.get("target/AddAnnotationStamp.ofd"); Path imgPath = Paths.get("src/test/resources", "StampImg.png"); try (OFDReader reader = new OFDReader(srcP); OFDDoc ofdDoc = new OFDDoc(reader, outP)) { Annotation annotation = new Annotation(70d, 100d, 60d, 60d, AnnotType.Stamp, ctx -> { ctx.setGlobalAlpha(0.53); ctx.drawImage(imgPath, 0, 0, 40d, 40d); }); ofdDoc.addAnnotation(1, annotation); } System.out.println("生成文档位置：" + outP.toAbsolutePath().toString()); }
@Test void addAnnotation() throws IOException { Path srcP = Paths.get("src/test/resources", "拿来主义_page6.ofd"); Path outP = Paths.get("target/AddWatermarkAnnot.ofd"); Path imgPath = Paths.get("src/test/resources", "eg_tulip.jpg"); try (OFDReader reader = new OFDReader(srcP); OFDDoc ofdDoc = new OFDDoc(reader, outP)) { ST_Box boundary = new ST_Box(50d, 50d, 60d, 60d); Annotation annotation = new Annotation(boundary, AnnotType.Watermark, ctx -> { ctx.setGlobalAlpha(0.53); ctx.drawImage(imgPath, 0, 0, 40d, 30d); }); ofdDoc.addAnnotation(1, annotation); ofdDoc.addAnnotation(3, annotation); ofdDoc.addAnnotation(5, annotation); } System.out.println("生成文档位置：" + outP.toAbsolutePath().toString()); }