3

我使用 iText 5.2.1 并且我已经创建了 Document 对象。

像这样:

document.addHeader("hello");

为什么我在 PDF 文件上看不到标题?

4

2 回答 2

2

使用页面事件。StackOverflow 上已经提供了许多好的答案,例如this onethis other one

于 2012-06-20T10:31:40.107 回答
-1
try {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream("FicheClient.pdf"));
        document.open();
        document.add(new Paragraph("hello World",FontFactory.getFont(FontFactory.TIMES_BOLD,20,Font.BOLD,BaseColor.BLACK)));
        document.add(new Paragraph("---------------------------------------"));
        document.close();
        JOptionPane.showMessageDialog(null, "Raport saved ");
    } catch (Exception e) {
    }
于 2014-06-16T12:14:29.000 回答