私は通常の PDF ファイルを持っていますitext LIBRARY
。PDF の内容を乱すことなく、PDF の最後に空白ページを挿入したいと考えています。
6617 次
2 に答える
0
よく私は答えを検索し、このようなものを見つけましたが、それが機能するかどうかはわかりません
public static void main(String[] args) throws IOException, DocumentException {
// step 1
Document document = new Document();
// step 2
PdfWriter writer
= PdfWriter.getInstance(document, new FileOutputStream(RESULT));
// step 3
document.open();
// step 4
document.add(new Paragraph("This page will NOT be followed by a blank page!"));
document.newPage();
// we don't add anything to this page: newPage() will be ignored
document.newPage();
document.add(new Paragraph("This page will be followed by a blank page!"));
document.newPage();
writer.setPageEmpty(false);
document.newPage();
document.add(new Paragraph("The previous page was a blank page!"));
// step 5
document.close();
}
于 2013-05-24T09:06:26.563 に答える