I'm having trouble embedding dynamic PDF within a specified area of a JSP using the <embed> tag.
My JSP code resembles the following: <embed src="<%=request.getContextPath()%>/controller/Administration/administrator_v iewcreate_invoice.jsp?Embed_Invoice=Embed_Invoice" width="100%" height="100%" type="application/pdf" /> When the JSP loads, this code fires off a request to the controller servlet which uses an action class to build a very basic (at the moment) pdf stream. A snippet of the action class code snippet is below: public String createPDFInvoice( HttpServletRequest request, HttpServletResponse response ) { HttpSession session = request.getSession(); Date todaysDate = new Date(); Customer customer = (Customer)session.getAttribute("CUSTOMER_TO_INVOICE"); Document document = new Document(PageSize.LETTER); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { PdfWriter writer = PdfWriter.getInstance(document,baos); document.open(); document.add(new Paragraph("Invoice")); document.add(new Paragraph(new Date().toString())); document.add(new Paragraph(customer.getFullName())); document.close(); response.setContentType("application/pdf"); response.setContentLength(baos.size()); ServletOutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); } catch ( Exception e ) { e.printStackTrace(); System.out.println("document: "+e.getMessage()); } return("/Administration/administrator_viewcreate_invoice.jsp"); } When the action class returns to the controller servlet, the following code is executed: requestedURL = request.getContextPath()+"/Administration/administrator_viewcreate_invoice.j sp"; try { response.sendRedirect(requestedURL); } catch( IOException ioe ) { System.out.println("Problems redirecting admin view/create invoice request in ControllerServlet."); ioe.printStackTrace(); } return; If I scrap the <embed> tag and just use a <form> tag with a target of a new window (target="_blank") the PDF shows up and takes up the entire browser window. I would like to use the <embed> tag as it is described in iText in Action (I've really enjoyed the book by the way - thus far) so that other items on my JSP are also displayed in addition to the section that is displaying the dynamic PDF. This is not working, however, using the code above. Some advice on where I have gone wrong here would be greatly appreciated. Thanks, Paul
<<attachment: winmail.dat>>
------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar