With the servers the classpath depends on the server itself. It uses its own
class loader to get the packages. You'll have to check the server's
documentation, or the WAR documention if you are using one.

Best Regards,
Paulo Soares
----- Original Message -----
From: "lily hu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 18:50
Subject: [iText-questions] create a pdf file from Servlet


> Hello,
>     I am trying to create a pdf file from a servlet. and then send the
> pdf file to the browser. To create the pdf file, I wrote:
>  --------------------start of servlet----------------------------------
> import java.io.FileOutputStream;
> import java.io.IOException;
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.PdfWriter;
> import javax.servlet.http.*;
> import javax.servlet.*;
>
> public class Chap0101 extends HttpServlet{
>     public void doGet (HttpServletRequest request, HttpServletResponse
> response)
>     throws IOException, ServletException{
>         Document document = new Document();
>         try {PdfWriter.getInstance(document, new
> FileOutputStream("sample.pdf"));
>               document.open();
>               document.add(new Paragraph("Hello World! Hahahaa!"));
>         }
>         catch(DocumentException de) {
>             System.err.println(de.getMessage());
>         }
>         catch(IOException ioe) {
>             System.err.println(ioe.getMessage());
>         }
>         document.close();
>     }
> }
> ----------------------------------end of Servlet-------------------
> But this program does not run. I got Error 500, saying the class can not
> be located by the server. I can run a java application ( with a main
> method) which has the same function. That means I do not have any
> problem with the classpath setting. Could you please tell me why I have
> this question? And I will greally appreciate if you can send me some
> servlet sample which create write to pdf files?
> Thanks a lot,
> Lily
>
>   _____
>
> Chat with friends online, try MSN Messenger: Click Here
> <http://g.msn.com/1HM500901/154>
>
> ------------------------------------------------------- Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
> _______________________________________________ iText-questions mailing
> list [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to