This question already has an answer here:
- iText - generating files on the fly without needing a PDF file 3 answers
I am trying to generate pdf file from jsp using itext jar. Could you please tell me how to retain the space or tab between strings as it is.
<%
response.setContentType("application/pdf");
String disHeader = "Attachment; Filename=\"example.pdf\"";
response.setHeader("Content-Disposition", disHeader);
Document document = new Document();
try{
PdfWriter.getInstance(document, response.getOutputStream());
document.open();
document.add(new Paragraph("Hello World"));
document.add(new Paragraph("Hello World"));
document.close();
}catch(DocumentException e){
e.printStackTrace();
}
%>
The space between "Hello" and "World" is not there in the generated pdf. How can i get the line as it is entered.
Thanks MRK