My, some can help me.

I use Neteans 3.3.1 with integrated Tomcat 3.2.

I'll use two servlets in this case. The first servlet to manage the request and
forward then to a second servlet.

In the case that the seconde servlet produce text/html it works fine, but if
i forward to a servlet that generate application/pdf no result is produced.
The second servlet work fine, wenn ich call direct.

The source:

import javax.servlet.*;
import javax.servlet.http.*;

public class test_forward extends HttpServlet {


    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {

        RequestDispatcher dispatcher =
            getServletConfig().getServletContext().getRequestDispatcher("/test_pdf");
        dispatcher.forward(request, response);

    }
}


import java.io.ByteArrayOutputStream;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import javax.servlet.*;
import javax.servlet.http.*;

public class test_pdf extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {


        response.setContentType("application/pdf");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        try
        {

            Document document = new Document(PageSize.A4);
            PdfWriter.getInstance(document,baos);

            document.open();
            document.add(new Paragraph("TEST"));
            document.close();

        }catch (Exception e){System.out.println(e.toString());}


        response.setContentLength( baos.size());
        baos.writeTo( response.getOutputStream() );

    }
}


My, some have an idea or sea my mistake.

regard Dietmar Müller




_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to