itext生成pdf文件的HelloWorld

来源:互联网 发布:淘宝买东西后退款bug 编辑:程序博客网 时间:2024/04/16 17:12
public class HelloWorld {public static void main(String args[]) throws FileNotFoundException, DocumentException {String fileName = "pdf/helloWorld.pdf";String content = "Hello World!";create(fileName, content);}private static void create(String fileName, String content) throws DocumentException, FileNotFoundException {//step1Document document = new Document();OutputStream os = new FileOutputStream(fileName);//step2PdfWriter.getInstance(document, os);//step3document.open();//step4document.add(new Paragraph(content));//step5document.close();}}

 

0 0
原创粉丝点击