Hi.

The code I sent you before created the PDF and stored it as a
ByteArrayOutputStream. That code then sent it to the web client. You can
also write the ByteArrayOutputStream to a file. Take a look at the API sun
has online for full documentation:
http://java.sun.com/j2se/1.3/docs/api/index.html

The code below takes a ByteArrayOutputStream and writes it to a file. Just
replace baos with the one from before. The folder you store it in is up to
you.

Chris

File file = new File("my.pdf");
FileOutputStream fo = new FileOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
baos.writeTo(fo);

> -----Original Message-----
> From: Pedro Barco Bernal [SMTP:[EMAIL PROTECTED]
> Sent: Tuesday, January 08, 2002 10:40 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Where put FOP the files on the server?
> 
> Thanks Chris!
> 
>     I need sonmething more easy. I want make the file in the same folder
> of
> my pages JSP. Could you help me??
> 
> Thanks.
> 
> Pedro Barco
> 
> ----- Original Message -----
> From: "Brunn, Chris" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 08, 2002 5:33 PM
> Subject: RE: Where put FOP the files on the server?
> 
> 
> > Hi.
> >
> > sample servlet code sniplet:
> >
> > // take the FO and write it to baosPDF
> > ByteArrayOutputStream baosPDF = new ByteArrayOutputStream();
> > Driver driver = new Driver(new InputSource( ---insert FO source
> here ----),
> > baosPDF);
> > driver.run();
> > // send baosPDF to the web client
> > response.setContentType("application/pdf");
> > byte[] content = baosPDF.toByteArray();
> > response.setContentLength(content.length);
> > response.getOutputStream().write(content);
> > response.getOutputStream().flush();
> >
> > Chris
> >
> > > -----Original Message-----
> > > From: Pedro Barco Bernal [SMTP:[EMAIL PROTECTED]
> > > Sent: Tuesday, January 08, 2002 9:49 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Where put FOP the files on the server?
> > >
> > > Hi *
> > >
> > >     I am working with FOP from 1 week, and I try to create a PDF file
> with
> > > JSP page, but I don't find the PDF file on the server.
> > >     What I have to do? Where put FOP the files on the server?
> > >     Thanks!
> > >     Sorry my poor english.
> > >
> > >     Pedro Barco
> > > ----- Original Message -----
> > > From: "Brunn, Chris" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, January 08, 2002 4:39 PM
> > > Subject: RE: where to put graphics referenced by external-graphic
> > >
> > >
> > > > Hi.
> > > >
> > > > Will the following work for you?
> > > >
> > > > <fo:external-graphic width="auto" height="auto"
> > > >
> src="http://localhost/path_or_alias_path/graphic_file_name.extension";
> />
> > > > If you must use relative paths, I know Xerces (1.4.3) has its root
> > > directory
> > > > in the root for the servlet engine. You could easily test if this is
> > > also
> > > > true for the FOP.
> > > > Chris
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Martin Monsorno [SMTP:[EMAIL PROTECTED]
> > > > > Sent: Tuesday, January 08, 2002 9:32 AM
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: where to put graphics referenced by external-graphic
> > > > >
> > > > > Hi *,
> > > > >
> > > > > I'm writing on a wep application which creates PDF document with
> > > > > fop. These documents should contain a graphic, I try to insert it
> with
> > > > > the <fo:external-graphic>-element.  The problem is now, how I can
> > > > > reference the graphic.
> > > > >
> > > > > The graphic-file should lie on the server, but it's not possible
> to
> > > > > use an absolute http-URL, because the server-name may not be known
> > > > > everytime. I tried to use a file://-URL, but this is also not
> possible
> > > > > for relative URLs, because I do not know the absolute path in any
> > > > > case, and furthermore I don't know where FOP assumes the
> > > > > root-directory (FOP is started from a servlet!).
> > > > >
> > > > > Does anybody has a solution to this problem? E.g. Is it possible
> to
> > > use
> > > > > relative URLs with this element?
> > > > >
> > > > >
> > > > > --
> > > > > Martin Monsorno
> > > > > mailto:[EMAIL PROTECTED]

Reply via email to