Java tutorial
import java.awt.Color; import java.awt.Toolkit; import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.PageSize; import com.lowagie.text.Paragraph; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.PdfWriter; public class MainClass { public static void main(String[] args) throws Exception { Rectangle r = new Rectangle(PageSize.A4); r.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); Document document = new Document(r); PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open(); java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage("dog.gif"); com.lowagie.text.Image img1 = com.lowagie.text.Image.getInstance(awtImage, null, true); document.add(img1); document.close(); } }