分类: Java
2010-10-11 14:01:02
import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Paragraph; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.PdfWriter; /** * * */ public class Simple6 { @SuppressWarnings("deprecation") public static void main(String[] args) throws DocumentException, IOException { //设置页面尺寸(纸张尺寸) Rectangle pageSize = new Rectangle(288/2, 720/2); //设置版心尺寸(内容尺寸,边距) Document doc = new Document(pageSize, 36, 18, 72, 72); PdfWriter.getInstance(doc, new FileOutputStream("E:/HelloWorld.pdf")); doc.open(); doc.add(new Paragraph("Test.......")); doc.add(new Paragraph("Test.......")); doc.add(new Paragraph("Test.......")); doc.close(); } }