|
Daniel,
Both your code and my code-snippet works just fine for me:
Try to open them in a new window by using the
javascript below.
****** freniltest.jsp *****
<%@ page import="com.lowagie.text.*" %><%@
page import="java.io.*" %><%@ page
import="com.lowagie.text.pdf.PdfWriter"%><%@ page
impo
rt="com.lowagie.text.pdf.ColumnText"%><%@ page import="com.lowagie.text.pdf.PdfContentByte"%><%@ page import="com.lowagie.text.pdf.BaseFont"%><% java.awt.Color border = new java.awt.Color(0xED, 0x1C, 0x24); Font font1 = new Font(Font.HELVETICA, 14, Font.NORMAL, border); Font font2 = new Font(Font.HELVETICA, 24, Font.BOLD, border); Font font3 = new Font(Font.HELVETICA, 12, Font.NORMAL, border); Document document = new Document(PageSize.A4, 30, 30, 80, 50); document.addSubject("Test"); java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(document, baos); document.open(); Paragraph p = new Paragraph("Hello world",font1); document.add(p); document.newPage(); document.close(); response.setContentType("application/pdf"); response.setContentLength(baos.size()); ServletOutputStream myOut = response.getOutputStream(); baos.writeTo(myOut); myOut.flush(); %> ******SNIPP!*****
******** SNIPP! index.jsp ****
<html>
<head> <script> function showPrintFrenilTest() { window.open("freniltest.jsp","myWin"); } </script> </head> <body> <br> <a href="">Freniltest</a> <br>
</body> </html> ******* SNIPP! ********* I use the index.jsp to call on the freniltest.jsp via a javascript
showPrintFrenilTest()
I also noticed that you do not use the setContentLength()
Regards,
/Fredrik
----- Original Message -----
|
Title: JSP, PDF, taglibs
- [iText-questions] JSP, PDF, taglibs Daniel Kalcevich
- Re: [iText-questions] JSP, PDF, taglibs Fredrik Nilsson
- RE: [iText-questions] JSP, PDF, taglibs Daniel Kalcevich
- RE: [iText-questions] JSP, PDF, taglibs Fredrik Nilsson
- RE: [iText-questions] JSP, PDF, taglibs Daniel Kalcevich
- Re: [iText-questions] JSP, PDF, taglibs Fredrik Nilsson
