import java.io.FileOutputStream;
import com.lowagie.text.Annotation;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
Image gif = Image.getInstance("Logo.gif");
gif.setAnnotation(new Annotation(0, 0, 0, 0, "http://www.java2java.com"));
gif.setAbsolutePosition(30f, 750f);
document.add(gif);
Image jpeg = Image.getInstance("dog.jpg");
jpeg.setAnnotation(new Annotation("picture", "dog", 0, 0,
0, 0));
jpeg.setAbsolutePosition(120f, 550f);
document.add(jpeg);
document.close();
}
}
|