Hello All,

I am using iText. It was working fine a few days back.
Now, it's not
working with Internet Explorer. I mean to say, when i
m trying to open the document inline ...it's not
opening up. But, it's working fine with netscape.

What can be the possible reason?? Please clarify.

The following is the simple code i m trying to run up
at IE.Please take a look
and suggest me.


import java.awt.color.*;
import com.lowagie.text.pdf.*;
import java.net.MalformedURLException;
import java.net.URL;

import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.io.*;
import java.sql.*;

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

import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;


public class test_pdf extends HttpServlet {
    
    
    public void init(ServletConfig config)
    throws ServletException {
        
        super.init(config);
    }
    
    /**
     * This method generates a PDF file with supply
chain network image.
     */
    
    public void doPost(HttpServletRequest request,
HttpServletResponse response)
    throws IOException, ServletException {
     
HttpSession sess = request.getSession();
                
com.lowagie.text.Document document  = new
com.lowagie.text.Document();

      // step2.1: creating an OutputStream
        ByteArrayOutputStream baos = new
ByteArrayOutputStream();
        
        try {           

                PdfWriter writer = PdfWriter.getInstance(document,
baos);
                document.open();
                
document.add(new Paragraph("Hello World"));
document.add(new Paragraph("I am now trying to open
the pdf document"));
document.add(new Paragraph("It should work fine."));
                
                }catch(Exception Excep)  {
                        System.out.println("Error " + Excep ) ;
                }finally{
                try{
                document.close();
                }catch (Exception ignored){}
                }   
        // we have written the pdfstream to a
ByteArrayOutputStream,
        // now we are going to write this outputStream
to the ServletOutputStream
        response.setContentType("application/pdf");
        response.setContentLength(baos.size());
        ServletOutputStream out =
response.getOutputStream();
        baos.writeTo(out);
        out.flush();
    }
        
}

Thanks and regards

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to