Rob Rob is a multi-language developer. In his spare time, he enjoys riding his motorcycle and playing guitar in his band.

Are you a Java Developer working with PDF files?

Find out why you should be using JPedal

How to create or edit Annotations in a PDF file with JPedal

1 min read

annotation_features

This articles shows you how to create and edit Annotations in a PDF file using the JPedal Swing Viewer. If you are looking to do this directly in Java code, we recommend this article.

In the JPedal Java PDF Library, we have implemented features allowing you to create and edit annotations on your PDF files in the Viewer. Here is a quick summary of how it works:

Creating annotations

We have added a new tab to the sidebar, labelled “Annotations”. From here, you can select a variety of annotation types to add to your PDF. Most require a simple click and drag/move, but each button has a helpful tool-tip if you are unsure on what to do.

The new Annotations sidebar
The new Annotations sidebar, with Polyline selected

After selecting an annotation type, the cursor will change to a crosshair when you move your mouse over the page (or if using the highlight tool, an I-cursor when over un-highlighted text). You are now free to start drawing!

Editing annotations

To select an existing annotation, simply left-click anywhere over it. You will know if it is selected – there will now be a fancy border around it and tabs around the edges for resizing the annotation.

A selected annotation
A selected annotation

To move annotations, simply click and hold anywhere on one, then drag it wherever you please on the page. Additionally, resizing is just as easy – click and drag one of the tabs around the edge of the annotation.

For more in-depth customisation, right-clicking an annotation will open a context menu from which you can select “properties”. This will open the properties window, where you can edit the line width, line colour and fill colour (where these options are supported) to your heart’s content – just click on an option to change it.

The properties panel
The properties window. Click on the coloured box to open the colour selection window
The colour selection window
The colour selection window
The properties panel, with the new colours
The properties window, with the new colours. Click OK and you are all done!
The annotation with the updated properties
The annotation with the updated properties

Of course, we are not stopping here – we already have plans to add more annotation types and features in the near future.

Is there anything you would like to see in the next annotations update? Let us know in the comments below.



The JPedal PDF library allows you to

Display PDF files in Java Apps
View PDF files in Java
Convert PDF Files to image
Rob Rob is a multi-language developer. In his spare time, he enjoys riding his motorcycle and playing guitar in his band.