There are many libraries to manipulate pdf using java, just google "java pdf libraries" or queries like this to see a plenty of them.