2012-06-28 3 views
0

나는이 프로그램에서 The document has no pages. 런타임 오류를 얻고있다 ...이 오류를 해결하는 방법 iTextPdf 문서 오류?

public class Windows { 

    public static void main(String[] args) throws FileNotFoundException, DocumentException { 

     java.io.File f = new java.io.File("c:/temp/text.pdf"); 
     java.io.FileOutputStream fo = new java.io.FileOutputStream(f); 

     com.itextpdf.text.Document d = new com.itextpdf.text.Document(PageSize.A5, 50, 50, 50, 50); 

     PdfWriter pw = PdfWriter.getInstance(d, fo); 
     d.open(); 

     Boolean b0 = d.newPage(); 
     Boolean b1 = d.addAuthor("Tamil Selvan"); 

     d.addCreator("Tamil Selvan"); 
     d.addHeader("Tamil Selvan Header name", "Header Content"); 
     d.addKeywords("These are the keywords for the document"); 
     d.addSubject("These are the subjects for the Document"); 
     d.addTitle("The Title Of the Document"); 

     d.close(); 

     System.out.println("Is the Documnet is Opened "+b0); 
     System.out.println("Is the Documnet is Working "+b1); 
    }; 
} 

어떻게 이것을 실행할 수 있습니까?

답변

0

나는 여기서 문제는 당신이 pdf에 대한 메타 데이터를 제공했지만 pdf에 대한 실제 본문이나 내용이 없다는 것이다.

예를 들어, 당신은 시도 할 수

d.add(new Paragraph("Some random text")); 

이 당신이 직면하고있는 오류를 해결하는 경우보고.