As Per Suggestion when I altered in the code in place of
document.add(ch);
I written
document.add(new Chunk(ch));
Following error appears at the time of compilation.
write_ascii_in_pdf.java:42: error: cannot find symbol
document.add(new Chunk(ch));
^
symbol: class Chunk
location: class write_ascii_in_pdf
1 error
And Moreover it is observed that when I altered in the code in place of
document.add(new Chunk(ch));
I written
document.add(new Paragraph(ch));
No error appears at the time of compilation, But the following run time error appears at the time of execution of the compiled code.
Exception in thread "main" ExceptionConverter: java.io.IOException: The document has no pages.
at com.itextpdf.text.pdf.PdfPages.writePageTree(PdfPages.java:113)
at com.itextpdf.text.pdf.PdfWriter.close(PdfWriter.java:1217)
at com.itextpdf.text.pdf.PdfDocument.close(PdfDocument.java:787)
at com.itextpdf.text.Document.close(Document.java:420)
at write_ascii_in_pdf.main(write_ascii_in_pdf.java:44)