+ All Categories
Home > Documents > Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS...

Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS...

Date post: 19-Feb-2018
Category:
Upload: duongtuyen
View: 227 times
Download: 2 times
Share this document with a friend
14
GIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO, SVG and Apache FOP Creating High Quality, Database- Driven Reports with Open Source Software
Transcript
Page 1: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

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

Page 2: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

Where is Uster?

Page 3: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

● 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

Page 4: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

● Integration into Existing Workflows● Integration with Web-Applications● Cost Effective for the medium and long run

The Task

Page 5: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

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

Page 6: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

The Workflow

Page 7: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

Map Generation

Main MapMain Map

Legend and ScalebarLegend and Scalebar Ref-Ref-MapMap

Page 8: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

Layout of the Object Data

Page 9: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

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

Page 10: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

● 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

Page 11: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

XSL-FO – File Structure

Page 12: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

● 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

Page 13: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

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

Page 14: Reporting with XSL-FO, SVG and Apache · PDF fileGIS-Kompetenzzentrum Uster A. Neumann, GIS Competence-Center Uster, Switzerland SVG Open, Nuremberg August 2008 Reporting with XSL-FO,

● 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


Recommended