java - how to clear this error iTextPdf Document error? -
i getting the document has no pages. runtime error in program...
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 keywords document"); d.addsubject("these subjects document"); d.addtitle("the title of document"); d.close(); system.out.println("is documnet opened "+b0); system.out.println("is documnet working "+b1); }; } how can run this?
i believe problem here have provided metadata pdf, no actual body or content pdf.
for example, can try
d.add(new paragraph("some random text")); and seeing if addresses error facing.
Comments
Post a Comment