Hi Richard.
I use the servlet supplied with FOP (in <fopdir>/examples/servlet/build/fop.war) and it works fine.
I'm afraid my Java familiarity is very basic - so can't comment on your code.
I use Apache 1.3.27 and Tomcat 5.0.28 and jdk_1_5_0_2
If you are processing an FO file that works fine under FOP 0.20.5 are you doing anything in your code that would strip attributes off your <fo:table-cell>?
(as your example has no attributes on any other table-cells - and the produced PDF is what you would get if the 'spanned' attributes were not present)
Richard Mixon (qwest) wrote:
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>
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.6 - Release Date: 06/05/2005
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
