六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 88|回复: 0

itext生成pdf文件的HelloWorld

[复制链接]

升级  8.67%

66

主题

66

主题

66

主题

举人

Rank: 3Rank: 3

积分
226
 楼主| 发表于 2013-1-15 01:58:43 | 显示全部楼层 |阅读模式
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();}} 
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表