You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ma...@spe.sony.com on 2004/09/16 03:02:37 UTC

FOP opening only 1 PDF when more than one is rendered?

I have a for loop which calls the XSLTHandler and then renderer in loop
till the input criteria is exhausted.

What happens is the acrobat reader opens only the last pdf file rendered...

My code looks like..whats happening is that only the last (10th ) invoice
is opening up in acrobat. I am running it under WEBLOGIC 7.0

for ( i = 0 to 10 invoices )
{

      XSLTInputHandler input = new XSLTInputHandler(invoicexmlfile,new
File(xslParam));
      renderXML( input, response);
}

public void renderXML(XSLTInputHandler input,
                      HttpServletResponse response) throws ServletException
{
    try {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        response.setContentType(CONTENT_TYPE);
        Driver driver = new Driver();
        String OS = System.getProperty("os.name");
        driver.setLogger(log);
        driver.setErrorDump(true);
        driver.setRenderer(Driver.RENDER_PDF);
        driver.setOutputStream(out);
        driver.render(input.getParser(), input.getInputSource());

        byte[] content = out.toByteArray();
        response.setContentLength(content.length);
        response.getOutputStream().write(content);
        response.getOutputStream().flush();
    } catch (Exception ex) {
        throw new ServletException(ex);
    }

Thanks
Manoj



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: FOP opening only 1 PDF when more than one is rendered?

Posted by Jebus <lo...@gmail.com>.
what you are doing is writing 10 separate documents to the
outputstream.  If you need all these documents to show up as one. you
iText to merge them together.

On Wed, 15 Sep 2004 18:02:37 -0700, manoj_nair@spe.sony.com
<ma...@spe.sony.com> wrote:
> I have a for loop which calls the XSLTHandler and then renderer in loop
> till the input criteria is exhausted.
> 
> What happens is the acrobat reader opens only the last pdf file rendered...
> 
> My code looks like..whats happening is that only the last (10th ) invoice
> is opening up in acrobat. I am running it under WEBLOGIC 7.0
> 
> for ( i = 0 to 10 invoices )
> {
> 
>       XSLTInputHandler input = new XSLTInputHandler(invoicexmlfile,new
> File(xslParam));
>       renderXML( input, response);
> }
> 
> public void renderXML(XSLTInputHandler input,
>                       HttpServletResponse response) throws ServletException
> {
>     try {
>         ByteArrayOutputStream out = new ByteArrayOutputStream();
>         response.setContentType(CONTENT_TYPE);
>         Driver driver = new Driver();
>         String OS = System.getProperty("os.name");
>         driver.setLogger(log);
>         driver.setErrorDump(true);
>         driver.setRenderer(Driver.RENDER_PDF);
>         driver.setOutputStream(out);
>         driver.render(input.getParser(), input.getInputSource());
> 
>         byte[] content = out.toByteArray();
>         response.setContentLength(content.length);
>         response.getOutputStream().write(content);
>         response.getOutputStream().flush();
>     } catch (Exception ex) {
>         throw new ServletException(ex);
>     }
> 
> Thanks
> Manoj
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: fop-user-help@xml.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org