나는 pdf 문서가있다, 예를 들면 25 페이지. 빈 페이지를 추가하는 방법 10 페이지와 11 페이지 구글에IText : pdf 안에 빈 페이지를 추가하는 방법?
2
A
답변
8
첫 번째 히트 : 당신이 어떤 내용을 추가하지 않은 경우
/*
* This class is part of the book "iText in Action - 2nd Edition"
* written by Bruno Lowagie (ISBN: 9781935182610)
* For more info, go to: http://itextpdf.com/examples/
* This example only works with the AGPL version of iText.
*/
package part1.chapter05;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
public class NewPage {
/** Path to the resulting PDF file. */
public static final String RESULT
= "results/part1/chapter05/new_page.pdf";
/**
* Main method creating the PDF.
* @param args no arguments needed
* @throws IOException
* @throws DocumentException
*/
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();
}
}
5
사용 후
, document.newPage();
무시됩니다. 빈 페이지가 필요한 경우 newPage()
을 호출 한 직후에 writer.setPageEmpty(false);
을 추가하십시오. 과 같이 작동합니다
http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfWriter.html#setPageEmpty(boolean)
:
Document doc = new Document();
PdfWriter pdfWriter
= PdfWriter.getInstance(document, new FileOutputStream("file.pdf"));
pdfWriter.setPageEmpty(false);
doc.newPage();
doc.close();
당신은 비록, 페이지가 비어 있지 않은지 작가에게
+0
나는 짧고 너무 요점이기 때문에이 대답이 가장 좋습니다. –
2
그냥 PDFWriter를 다음과 같은 방법을 살펴 가지고 그렇기 때문에 새로운 페이지가 생성 될 것입니다.
관련 문제
- 1. iText 셀 안에 중첩 테이블
- 2. Itext 일주일에 pdf
- 3. itext - pdf to html
- 4. 안드로이드에 iText PDF 리더
- 5. iText PDF 동적 생성
- 6. iText PDF 파일
- 7. itext pdf issue
- 8. PDF 파일 작성 및 다운로드시 빈 페이지 (iText 및 JSF)
- 9. iText Pdf 페이지 바이트 크기
- 10. CMY 색상의 iText PDF 만 작성하는 방법
- 11. iText PDF MultiColumnText 줄의 높이
- 12. iText 오류로 PDF 양식 채우기
- 13. iText 생성 PDF 자동 인쇄
- 14. IText #
- 15. iText 5.2.1에서 헤더를 추가하는 방법은 무엇입니까?
- 16. PDF를 만들고 내용을 추가하는 방법 안드로이드에 iText 라이브러리 usnig ...?
- 17. iText : PDF 페이지가 LETTER 또는 LEGAL 크기인지 감지하는 방법
- 18. 봄, IText, 워터 마크로 PDF 만들기
- 19. 빈 페이지로 PDF 분할?
- 20. 웹 응용 프로그램에서 PDF 만들기 iText
- 21. window.print() 빈 페이지를 인쇄합니다.
- 22. 펄을 사용하여 PDF 페이지를 이동하는 방법 (CAM :: PDF, PDF :: API2)?
- 23. iTextSharp를 사용하여 PDF에 빈 페이지를 추가하는 방법은 무엇입니까?
- 24. 빈 행을 JQGrid에 추가하는 방법
- 25. Android itext 이외의 PDF 파일 만들기
- 26. iText PDF 링크에 닫는 대괄호가 포함되어 있습니다.
- 27. PDF 서명을위한 Java API (iText 사용 불가)
- 28. itext (java)에서 PDF 파일 크기 줄이기
- 29. iText 특정 페이지의 PDF 머리글 제거
- 30. iText - 두 번째 PDF 생성 시도 실패
+1 올바른 것을 잡았습니다. –