Hi,
 
I am having problems with displaying the dynamically generated PDF using iText on the browser. I have set the response content length as mentioned in the FAQ section, but the PDF is not getting displayed yet. Could anyone help.
 
My code is as follows:
 
PdfReader reader = new PdfReader(new URL(urlString.toString()));
PdfStamper stamp = new PdfStamper(reader, ba);

AcroFields afields = stamp.getAcroFields();
HashMap fieldsHM = afields.getFields();

if ((String) session.getAttribute("txtFirstName") != null) {
if ((String) session.getAttribute("txtFirstName") != null)
afields.setField(
"txtFirstName",
(String) session.getAttribute("txtFirstName"));
} else {
if ((String) req.getParameter("txtFirstName") != null)
afields.setField(
"txtFirstName",
(String) req.getParameter("txtFirstName"));
}

stamp.close();

resp.setContentLength(ba.size());
ServletOutputStream out = resp.getOutputStream();
ba.writeTo(out);
out.flush();

I had tried generating the PdfStamper output to "response.getOutputStream()" also, and the same problem.
 
Thanks in advance.

 


Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online

Reply via email to