为什么 Java 要删除段落之间的空格?我正在使用 iText5 将.rtf文件转换为 PDF。该文件包含报告,每个报告都位于其自己的页面上。转换后,段落之间的空格将被删除,使分页与转换前不同。
我尝试使用 Rectangle 设置页面大小,但由于报表的行数不同,因此某些报表仍与其他报表共享同一页。
//Set PDF layout
//Rectangle rectangle = new Rectangle (0, 0, 1350, 16615);
Document document = new Document(PageSize.A4.rotate());
document.setMargins(13, 0, 10, 10);
PdfWriter.getInstance(document, new FileOutputStream(dest));
document.open();
br = new BufferedReader(new FileReader(TEXT));
String line;
Paragraph p;
//PDF font configuration
Font normal = new Font(FontFamily.COURIER, 5);
Font bold = new Font(FontFamily.COURIER, 5, Font.BOLD);
//add page to PDF
boolean title = true;
while ((line = br.readLine()) != null) {
p = new Paragraph(line, title ? bold : normal);
document.add(p);
}
document.close();
我不希望程序删除段落之间的空格。
12345678_0001
相关分类