Date post: | 19-Feb-2018 |
Category: |
Documents |
Upload: | duongtuyen |
View: | 227 times |
Download: | 2 times |
GIS-Kompetenzzentrum Uster
A. Neumann, GIS Competence-Center Uster, Switzerland
SVG Open, Nuremberg
August 2008
Reporting with XSL-FO, SVGand Apache FOP
Creating High Quality, Database-Driven Reports with Open Source
Software
Where is Uster?
● Developing a Reporting System Capable of Transforming Database and XML information to nice printable documents
● Flexible System capable of implementing complex layouts and meeting various different user requirements
● Applicable to different domains, such as reports in● Surveying● Energy supply: gaz, water, electricity● Waste Water● Urban planning● Road Management● etc.
The Task
● Integration into Existing Workflows● Integration with Web-Applications● Cost Effective for the medium and long run
The Task
Documenting Green-Space Areassuch as parks, refuges and traffic islands
● Basic Object Information● Tables with Feature Information● Photo(s)● Responsible Person/Company and Contact Info● Planting/Creation and Maintenance Tasks● Maps● Potentially also Charts
The Specific Task – Green Space Documentation
The Workflow
Map Generation
Main MapMain Map
Legend and ScalebarLegend and Scalebar Ref-Ref-MapMap
Layout of the Object Data
Using some XSLT2 functionality: advanced sorting and aggregating functions
→ Have to use XSLT2 processor (Saxon9B)
Xalan (within Apache FOP) not offering XSLT2 functionality
java net.sf.saxon.Transform -s input_data.xml -o output.fo gruenflaechen.xsl
Good Performance (<1 sec)
XSLT Transformation
● XSL-FO is an advanced DTP language● Existing XML/HTML knowledge can be-reused● Notion of block-elements:
● Page● Printable Area● Columns/Tables, etc.● Paragraph● Line● Word● Individual Character
XSL-FO – Transforming XML/SVG to PDF
XSL-FO – File Structure
● Inline within the XSL-FO markup(in it's own namespace)<fo:block>
<fo:instream-foreign-object>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="8cm" height="5cm" viewBox="0 0 80 50">
<svg:rect x="1" y="1" width="78" height="48" fill="white" stroke="black"
stroke-width="0.25"/>
<svg:text x="40" y="27" font-size="5" font-family="Tahoma">Photo-Placeholder</svg:text>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
● References to external Files
<fo:block space-before="15pt" text-align="center"> <fo:external-graphic src="url('graphics.svg')" content-height="18cm" content-width="18cm"/>
</fo:block>
Two Ways to Integrate SVG
Using Apache FOP, uses Apache Batik for SVG renderinghttp://xmlgraphics.apache.org/fop/
Apache License, Goal is to be XSL-FO conformantRenders to: Printer, PDF, PS, PCL, SVG, TIFF, RTF, AWTSupports Font-Embedding in SVG: Type1 and TT-Fonts
fop -c userconfig.xml -dpi 250 -fo gruenflaechen.fo -pdf gruenflaechen.pdf
Time to Render to PDF (without any optimization):<2 minutes for 210 pages, 630 external SVG files
XSL-FO Processing
● The XSL-FO and SVG combo is very powerful● Initially it takes more time to get into XSLT and XSL-
FO, but in the medium and long view it pays off● If you can re-use templates and XSLT documents,
follow-up projects can be implemented very quickly● Fits in nicely with already existing system
architectures● Works well for web-applications
● XSL-FO and SVG-Printing deserves more attention both from the SVG community and from the printing industry
● XSL-FO / SVG Workshop at one of the upcoming SVG Open conferences?
Conclusion