Skip to content

Instantly share code, notes, and snippets.

How to Add Ellipse Annotation in PDF using Java. For more information, please follow link: https://kb.groupdocs.com/
import com.groupdocs.annotation.Annotator;
import com.groupdocs.annotation.licenses.License;
import com.groupdocs.annotation.models.PenStyle;
import com.groupdocs.annotation.models.Rectangle;
import com.groupdocs.annotation.models.annotationmodels.EllipseAnnotation;
import java.util.Calendar;
public class AddEllipseAnnotationinPDFusingJava {
public static void main(String[] args) {
// Set License to avoid the limitations of Annotation library
License license = new License();
license.setLicense("GroupDocs.Annotation.lic");
// Create an instance of Annotator class
Annotator annotator = new Annotator("input.pdf");
// Create an instance of EllipseAnnotation class and set options
EllipseAnnotation ellipse = new EllipseAnnotation();
ellipse.setBackgroundColor(65535);
ellipse.setBox(new Rectangle(100, 100, 100, 100));
ellipse.setCreatedOn(Calendar.getInstance().getTime());
ellipse.setMessage("This is ellipse annotation");
ellipse.setOpacity(0.7);
ellipse.setPageNumber(0);
ellipse.setPenColor(65535);
ellipse.setPenStyle(PenStyle.DOT);
ellipse.setPenWidth((byte) 3);
// Add ellipse annotation to Annotator
annotator.add(ellipse);
// Save the final PDF to disk
annotator.save("result.pdf");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment