Hi, how do you specify the file name when running from
a servlet that creates the
output to the screen.

I have read Bruno's response and I tried to figure it
out for about 1/2 of a day. Ok I am
slow but I don't get it.

I know you can create a file name if you are writing
the file to the hard drive but when
when the output is to ByteArrayOutputStream you have
to :
PdfWriter.getInstance(document, baos);
Not
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("Chap01xx.pdf"));



FROM: BrunoDATE: 06/03/2002 00:40:59SUBJECT: RE: 
[iText-questions] filename and path (My Documents)
Quoting Ronald Tooley <<EMAIL: PROTECTED>>:

> Hi, I am calling a servlet that creates the PDF file
from a JPS. How do I set
> the filename and path for this file. I would like
the path to be the users
> "My Documents" directory.
> 
>             Document document = new Document();

You want to write to a file, not a browser, so you
don't need
a ByteArrayOutputStream: 
>             ByteArrayOutputStream baos = new
ByteArrayOutputStream();
You can write directly to a FileOutputStream.
Read the Java API (from SUN) for
java.io.FileOutputStream for
more info.

In you small code sample, you jump from step 1 to step
3,
you forgot step 2:
http://www.lowagie.com/iText/tutorial/ch01.html#step2

>             document.open();

Bruno


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

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

Reply via email to