Document pdfDocument =
new
Document(
"input.pdf"
);
TextAnnotation textAnnotation =
new
TextAnnotation(pdfDocument.getPages().get_Item(1),
new
com.aspose.pdf.Rectangle(200, 400, 400, 600));
textAnnotation.setTitle(
"Sample Annotation Title"
);
textAnnotation.setSubject(
"Sample Subject"
);
textAnnotation.setState(AnnotationState.Accepted);
textAnnotation.setContents(
"Sample contents for the annotation"
);
textAnnotation.setOpen(
true
);
textAnnotation.setIcon(TextIcon.Key);
Border border =
new
Border(textAnnotation);
border.setWidth(5);
border.setDash(
new
Dash(1, 1));
textAnnotation.setBorder(border);
textAnnotation.setRect(
new
com.aspose.pdf.Rectangle(200, 400, 400, 600));
pdfDocument.getPages().get_Item(1).getAnnotations().add(textAnnotation);
pdfDocument.save(
"output.pdf"
);
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。