In this blog, I’ll introduce how to add text watermark and image watermark to a PDF file using Free Spire.PDF for Java library. Before using the below code, you need to download Free Spire.PDF for Java from this link and import the jar file under the lib folder to your project. Add text watermark import com.spire.pdf.*; import com.spire.pdf.graphics.*; import java.awt.*; import java.awt.geom.*; public class Watermark { public static void main(String[] args){ // load PDF file PdfDocument pdf = new PdfDocument(); pdf.loadFromFile( "Software - Wikipedia.pdf" ); //add text watermark to every page in the PDF file for ( int i = 0 ; i< pdf.getPages().getCount(); i++) { Pdf...
A blog about Microsoft Office and PDF document development using .NET and Java.