Reporting with XSL-FO, SVG and Apache FOP - SVG Open
Reporting with XSL-FO, SVG and Apache FOP - SVG Open
Reporting with XSL-FO, SVG and Apache FOP - SVG Open
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
GIS-Kompetenzzentrum Uster<br />
<strong>Reporting</strong> <strong>with</strong> <strong>XSL</strong>-<strong>FO</strong>, <strong>SVG</strong><br />
<strong>and</strong> <strong>Apache</strong> <strong>FO</strong>P<br />
Creating High Quality, Database-<br />
Driven Reports <strong>with</strong> <strong>Open</strong> Source<br />
Software<br />
A. Neumann, GIS Competence-Center Uster,<br />
Switzerl<strong>and</strong><br />
<strong>SVG</strong> <strong>Open</strong>, Nuremberg<br />
August 2008
Where is Uster?
● Developing a <strong>Reporting</strong> System Capable of<br />
Transforming Database <strong>and</strong> XML information to nice<br />
printable documents<br />
● Flexible System capable of implementing complex<br />
layouts <strong>and</strong> meeting various different user<br />
requirements<br />
● Applicable to different domains, such as reports in<br />
● Surveying<br />
● Energy supply: gaz, water, electricity<br />
● Waste Water<br />
● Urban planning<br />
● Road Management<br />
● etc.<br />
The Task
The Task<br />
● Integration into Existing Workflows<br />
● Integration <strong>with</strong> Web-Applications<br />
● Cost Effective for the medium <strong>and</strong> long run
The Specific Task – Green Space Documentation<br />
Documenting Green-Space Areas<br />
such as parks, refuges <strong>and</strong> traffic isl<strong>and</strong>s<br />
● Basic Object Information<br />
● Tables <strong>with</strong> Feature Information<br />
● Photo(s)<br />
● Responsible Person/Company <strong>and</strong> Contact Info<br />
● Planting/Creation <strong>and</strong> Maintenance Tasks<br />
● Maps<br />
● Potentially also Charts
The Workflow
Map Generation<br />
Main Map<br />
Legend <strong>and</strong> Scalebar<br />
Ref-<br />
Map
Layout of the Object Data
<strong>XSL</strong>T Transformation<br />
Using some <strong>XSL</strong>T2 functionality: advanced sorting <strong>and</strong><br />
aggregating functions<br />
→ Have to use <strong>XSL</strong>T2 processor (Saxon9B)<br />
Xalan (<strong>with</strong>in <strong>Apache</strong> <strong>FO</strong>P) not offering <strong>XSL</strong>T2<br />
functionality<br />
java net.sf.saxon.Transform -s<br />
input_data.xml -o output.fo<br />
gruenflaechen.xsl<br />
Good Performance (
<strong>XSL</strong>-<strong>FO</strong> – Transforming XML/<strong>SVG</strong> to PDF<br />
● <strong>XSL</strong>-<strong>FO</strong> is an advanced DTP language<br />
● Existing XML/HTML knowledge can be-reused<br />
● Notion of block-elements:<br />
● Page<br />
● Printable Area<br />
● Columns/Tables, etc.<br />
● Paragraph<br />
● Line<br />
● Word<br />
● Individual Character
<strong>XSL</strong>-<strong>FO</strong> – File Structure
Two Ways to Integrate <strong>SVG</strong><br />
● Inline <strong>with</strong>in the <strong>XSL</strong>-<strong>FO</strong> markup<br />
(in it's own namespace)<br />
<br />
<br />
<br />
<br />
Photo-Placeholder<br />
<br />
<br />
<br />
● References to external Files<br />
<br />
<br />
<strong>XSL</strong>-<strong>FO</strong> Processing<br />
Using <strong>Apache</strong> <strong>FO</strong>P, uses <strong>Apache</strong> Batik for <strong>SVG</strong> rendering<br />
http://xmlgraphics.apache.org/fop/<br />
<strong>Apache</strong> License, Goal is to be <strong>XSL</strong>-<strong>FO</strong> conformant<br />
Renders to: Printer, PDF, PS, PCL, <strong>SVG</strong>, TIFF, RTF, AWT<br />
Supports Font-Embedding in <strong>SVG</strong>: Type1 <strong>and</strong> TT-Fonts<br />
fop -c userconfig.xml -dpi 250 -fo<br />
gruenflaechen.fo -pdf gruenflaechen.pdf<br />
Time to Render to PDF (<strong>with</strong>out any optimization):<br />
Conclusion<br />
● The <strong>XSL</strong>-<strong>FO</strong> <strong>and</strong> <strong>SVG</strong> combo is very powerful<br />
● Initially it takes more time to get into <strong>XSL</strong>T <strong>and</strong> <strong>XSL</strong>-<br />
<strong>FO</strong>, but in the medium <strong>and</strong> long view it pays off<br />
● If you can re-use templates <strong>and</strong> <strong>XSL</strong>T documents,<br />
follow-up projects can be implemented very quickly<br />
● Fits in nicely <strong>with</strong> already existing system<br />
architectures<br />
● Works well for web-applications<br />
● <strong>XSL</strong>-<strong>FO</strong> <strong>and</strong> <strong>SVG</strong>-Printing deserves more attention<br />
both from the <strong>SVG</strong> community <strong>and</strong> from the printing<br />
industry<br />
● <strong>XSL</strong>-<strong>FO</strong> / <strong>SVG</strong> Workshop at one of the upcoming <strong>SVG</strong><br />
<strong>Open</strong> conferences?