com.cete.dynamicpdf.pageelements
Class ImageWatermark


Example: The following example will display ImageWatermark on the page.

 import com.cete.dynamicpdf.*;
 import com.cete.dynamicpdf.pageelements.*;
 import java.io.FileNotFoundException;

 public class MyClass{
       public static void main(String args[]){
       
           // Create a PDF Document
           Document document = new Document();
		   
		   //Set PDF version to 1.6
           document.setPdfVersion(PdfVersion.v1_6);
 
           // Create a Page and add it to the document
           Page page = new Page();
           document.getPages().add(page);
		   
		   // Create an image for the watermark
           ImageWatermark imageWm = null;
           try {
                imageWm = new ImageWatermark("[physicalpath]/MyImage.png");
           }catch (FileNotFoundException ex) {
                System.out.println("File does not exist");
           }
		   
           // Add the TextWatermark to the page
           page.getElements().add(imageWm);    
 
           // Save the PDF
           document.draw("[physicalpath]/MyDocument.pdf" );
       }
 }