In this tutorial, you will learn how to add circle in PDF using Java. It provides configuration details, the logical steps to write the program to draw circle in Adobe Acrobat using Java, and a runnable sample code to demonstrate the process. It will also discuss different options to format the circle as well and then save the resultant file on the disk.
Steps to Add a Circle to a PDF using Java
- Set the IDE to add Aspose.PDF for Java to add a circle
- Create a new PDF document and add a page to it for adding graphics object
- Create a circle with a specified position and radius
- Set circle properties like its color
- Create a Graph object and add the circle to it
- Add this graph to the paragraphs collection of the selected page and save it on the disk
These steps explain how to draw a circle in Adobe PDF using Java. First, a circle is created and its color is set that is followed by the creation of a Graph class object that is used to contain the drawing objects in a PDF. In the next steps, this circle is added to the graph object that is finally added to the paragraphs collection of the selected page before saving it on the disk.
Code to Add Circle to PDF using Java
This code demonstrates how to insert circle in PDF using Java. It uses the Circle class object to create a circle by providing position and radius and then uses the getGraphInfo() method of the Circle class to set the color. You may set other properties also like fill color, line width, rotation angle for the coordinates system, and the scaling rate for the coordinates transformation.
In this topic, we have learned how to add circle to PDF using Java. If you want to learn the process to add digital signatures to PDF, refer to the article on how to add digital signature to PDF in Java.