Mike Trotman wrote:
> Your FO code works correctly in my version fo FOP 0.20.5 - the
> separator rows span 6 columns. 
> 
> I used the commandline:
> fop.sh -fo span.fo -pdf span.pdf.
> 
> As you have a variable for your report header - this suggests to me
> that you are doing other processing before you actually produce final
> output?  
> 
> I use tables and spanning rows / columns almost every day - and have
> never hit any problems with FOP 0.20.5. *There are other problems
> with tables - but not with cols/rows spanned.) 
> 
> I've always downloaded the binary installations - so have never built
> FOP from source. 
> I use it on  RedHat 7.3 and  Fedora Core 2
> 
> 
> Below is the output if I use 'fop.sh -fo span.fo -txt span.txt'
> What do you get on your system?


Mike,

Thank you for checking this out. Basically I am using a 2004/05/29 build
of FOP and invoking it from a servlet using Tomcat 5.5.7 and Sun JDK 1.5
sp1. With with FOP 0.20.5 from the command line it works fine.

And yes, I am doing some processing using JSP/JSTL to generate the
documents. It is a database report. For problem resolution I tried to
reduce it to a simple FO document without the JSP/JSTL  - but obviously
missed a couple of statements. Thanks for noticing - however it still
processes fine with FOP 0.20.5.

If you know anything about invoking FOP from a servlet, could you take a
look at the code below and see if anything appears out of place?  I had
been using this to process SVG diagrams (wrapped with FO statements of
course) into PDF for quite a while with no problem. This is my first
attempt using a straight FO document - but did not believe it should be
a problem.

I have also attached the PDF I get as output - but I am not sure if it
will make it through the list processing, even though its tiny.

Thank you once again - Richard


<!-- BEGIN FROM servlet ini method, run once at startup -->
        logger = new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG);
        transFactory = TransformerFactory.newInstance();
        imageURLProtocol = getInitParameter("imageURLProtocol");
        String httpBaseDir = ".";
        String baseDir =
this.getServletContext().getRealPath(httpBaseDir);
        userAgent = new FOUserAgent();
        userAgent.setBaseURL(imageURLProtocol+baseDir);
<!-- END   FROM servlet ini method, run once at startup -->

<!-- BEGIN FROM servlet doGet method, run once per file I process -->
        String contentFO = (String)session.getAttribute(attrName);
        String title;
        String wrappedContent = contentFO.trim();

        StringReader sr = new StringReader( wrappedContent );
        Source inSrc = new StreamSource(sr);
        String pdfOutName = null;
        FileOutputStream pdfOut = null;

        try {
            Transformer transformer = transFactory.newTransformer();
            pdfOutName =
FileUtil.getUserOutputFileName(null,".pdf",request);
            File tempDir =
(File)request.getSession().getServletContext().getAttribute("javax.servl
et.context.tempdir");
            File pdfOutFile = new File(
tempDir.getPath()+File.separator+pdfOutName );
            pdfOutFile.createNewFile();
            pdfOut = new FileOutputStream( pdfOutFile );
            Driver driver = new Driver();
            driver.setRenderer(Driver.RENDER_PDF);
            driver.setUserAgent(userAgent);
            driver.initialize();
            driver.setOutputStream(pdfOut);

            //Make sure the XSL transformation's result is piped through
to FOP
            Result res = new SAXResult(driver.getContentHandler());

            //Start the transformation and rendering process
            transformer.transform(inSrc, res);
            driver.reset();
            pdfOut.flush();
            pdfOut.close();
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new ServletException(ex);
        } finally {
            File pdfFile = new File( pdfOutName );
        }
<!-- END   FROM servlet doGet method, run once per file I process -->
<SNIP>

Attachment: lir.pdf
Description: Adobe PDF document

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to