I need to display a pdf document within a frame in a
JSP page.
In this JSP page, the left frame is a navigation menu.
The right frame is pdf content.
I use
struts 1.3 and tiles to implement frames.
To generate pdf ,I use itext.
Here is the sample code
public ActionForward doGenerateLeterPDF(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse response) throws WebException {
try{
Document document = new Document();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, baos);
document.open();
document.add(new Paragraph("Hello World"));
document.close();
response.setContentType("application/pdf");
response.setContentLength(baos.size());
ServletOutputStream out = response.getOutputStream();
baos.writeTo(out);
}catch(Exception e)
{
logger.error("Exception: " + e);
}
return null;
}
However, after I execute this action class, the pdf displayed in full screen
My request is pdf content only staying in one frame
Any clues on how to implement this?
Thanks,