• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • salvin francis
  • Piet Souris

How jsp and a pdf document displayed in the same browser?

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 {
Document document = new Document();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, baos);
document.add(new Paragraph("Hello World"));

ServletOutputStream out = response.getOutputStream();
}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?

Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also facing the same issue. Please provide some link or tell us how to do it.
Posts: 43011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code shown above needs to be executed when the URL of the frame is accessed, not when the URL of the page itself is accessed.
Always! Wait. Never. Shut up. Look at this tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!