com.cete.dynamicpdf.pageelements
Class TransparencyGroup


Example: The following example will display text with a transparent rectangle over it. The text will be visible beneath the rectangle.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
 
public class MyClass{
       public static void main(String args[]){
 
           // Create a PDF Document
           Document document = new Document();
 
           // Create a Page and add it to the document
           Page page = new Page();
           document.getPages().add(page);
 
           // Create a transparency group and add a rectangle to it
           TransparencyGroup group = new TransparencyGroup(0.5f);
           group.add(new Rectangle( 50, 0, 100, 100, RgbColor.getRed(), RgbColor.getRed()));
 
           // Add a label to the page
           page.getElements().add(new Label("This text is beneath the rectangle.", 
           0, 0, 200, 12));
 
           // Add the transparency group to the page
           page.getElements().add(group);
 
           // Save the PDF
           document.draw("[Physicalpath]/MyDocument.pdf");
       }
 }