import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
byte circledata[] = { (byte) 0x3c, (byte) 0x7e, (byte) 0xe7, (byte) 0xc3, (byte) 0xc3,
(byte) 0xe7, (byte) 0x7e, (byte) 0x3c };
Image mask = Image.getInstance(8, 8, 1, 1, circledata);
mask.makeMask();
mask.setInvertMask(true);
Image img = Image.getInstance("dog.jpg");
img.setImageMask(mask);
document.add(img);
document.add(Image.getInstance(8, 8, 1, 1, circledata));
document.add(mask);
document.close();
}
}