Well, actually i'm doing some stuff like you want to
do it.
I use Tomcat 5.0.16 (but if you have a J2EE
application server with support to Servlet 2.4 it's
fine) i have the next elements:
1.- jsp page: generates the valid XML to be parsed by
iText. Here i use TagLib's to get the data and
generate the XML, my model is based in generators,
each object knows how to be represented in valid XML
to be parsed in iText, then i pasted every component
in the jsp page, the result is a XML.
2.- filter: intercepts the call to the jsp, call to
the jsp, takes the response (in the response i put the
stream that contains the XML) and parse it with iText
in a new Document, and write the OutputStream to the
response you should merge the iText example about
Servlets and the next information:
http://java.sun.com/products/servlet/Filters.html
i add the method doFilter, look it i hope it will be
usefull for you
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain chain)
throws IOException, ServletException {
response.setContentType("application/pdf");
CharResponseWrapper wrapper=new
CharResponseWrapper((HttpServletResponse)response);
chain.doFilter(request, wrapper);
StringReader sr = new
StringReader(wrapper.toString());
Document document = new
Document(PageSize.LETTER, 80, 50, 30, 65);
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
try {
PdfWriter.getInstance(document, baos);
PdfWriter.getInstance(document,
new
FileOutputStream(realPath + "/pruebita.pdf"));
XmlParser.parse(document, (Reader)sr);
}
catch(DocumentException de) {
System.err.println(de.getMessage());
de.printStackTrace();
}
document.close();
response.reset();
response.setContentLength(baos.size());
ServletOutputStream out =
response.getOutputStream();
baos.writeTo(out);
out.flush();
}
--- [EMAIL PROTECTED] wrote:
> Hi
>
> I want to use iText to generate an XML document and
> use this XML to generate a
> PDF for a J2EE web-app on Oracle 9iAS version
> 9.0.2.3. I want to generate the
> XML, parse this and return the PDF content without
> storing any files on the
> server. Does anyone know how this can be done?
>
> Is it possible to generate the XML, parse it and
> generate the PDF and return
> this PDF through the HTTP response? How is this
> done?
>
> regards
> Bent A Melsom
>
>
>
>
----------------------------------------------------------------
> This message was sent using IMP, the Internet
> Messaging Program.
>
>
>
-------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback
> Program.
> Does SourceForge.net help you be more productive?
> Does it
> help you create better code? SHARE THE LOVE, and
> help us help
> YOU! Click Here: http://sourceforge.net/donate/
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
>
https://lists.sourceforge.net/lists/listinfo/itext-questions
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions