//创建文本
Document document = new Document();
try {
//写入文本到文件中
PdfWriter.getInstance(document, new FileOutputStream("Paragraph.pdf"));
//打开文本
document.open();
//定义段落
Paragraph paragraph = new Paragraph();
//插入十条文本块到段落中
int i=0;
for(i=0; i<10; i++){
Chunk chunk = new Chunk("This is a sentence which is long " + i + ". ");
paragraph.add(chunk);
}
//添加段落
document.add(paragraph);
//关闭文本
document.close();
} catch (DocumentException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}