Use our service in your infrastructure

You can easyly integrate our service endpoint into your infrastructure. If you need assistance or customization you can contact us. For integration you can visit the OpenApi interface at https://api.pdf-weaver.io/swagger/index.html

Contact
Novent Concepts
Wehneltsteig 7
13629 Berlin
Germany

+49 30 345 081 46
+49 151 676 175 24
Christian Greinke via [email protected]

Getting Started with XSL-FO

XSL-FO (Extensible Stylesheet Language-Formatting Objects) is an XML-based language used to define the visual appearance of XML documents when they are transformed into other formats, such as PDF. XSL-FO provides a powerful way to create visually appealing documents while preserving the structure and semantics of the XML data.

1. Basic Structure

An XSL-FO document consists of a root element <fo:root> containing layout master sets and page sequences. The layout master set defines the page templates, and the page sequences contain the actual content.
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <!-- Page templates -->
  </fo:layout-master-set>
  <fo:page-sequence master-reference="...">
    <!-- Content -->
  </fo:page-sequence>
</fo:root>
              

2. Page Templates

Page templates are defined using <fo:simple-page-master> elements. You can specify the dimensions, margins, and regions of the page.
<fo:simple-page-master 
      master-name="A4" 
      page-height="29.7cm" 
      page-width="21cm" 
      margin-top="1cm" 
      margin-bottom="1cm" 
      margin-left="1cm" 
      margin-right="1cm"
>
  <fo:region-body margin-top="1cm" margin-bottom="1cm"/>
  <fo:region-before extent="1cm"/>
  <fo:region-after extent="1cm"/>
</fo:simple-page-master>
              

3. Content and Formatting

Content is added within <fo:page-sequence> elements using <fo:flow> and various formatting objects like <fo:block> for text blocks, <fo:table> for tables, and <fo:list-block> for lists.
<fo:flow flow-name="xsl-region-body">
  <fo:block font-size="14pt" font-weight="bold" space-after="0.5cm">
    Document Title
  </fo:block>
  <fo:block font-size="12pt" text-align="justify">
    This is a paragraph of text that will be 
    formatted with justified alignment.
  </fo:block>
</fo:flow>
              

4. Transforming XML with XSL-FO

To transform XML data into a PDF document using XSL-FO, you'll need an XSLT stylesheet that maps the XML elements to the appropriate XSL-FO formatting objects.
<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
    version="1.0"
>
  <xsl:template match="/">
    <fo:root>
      <!-- XSL-FO structure and content -->
    </fo:root>
  </xsl:template>
</xsl:stylesheet>
              

Further Resources

For more in-depth information and tutorials, refer to the following resources: These resources provide a more comprehensive understanding of XSL-FO and its capabilities, allowing you to create complex and visually appealing documents using XML data.

Contact
Novent Concepts
Wehneltsteig 7
13629 Berlin
Germany

+49 30 345 081 46
+49 151 676 175 24
Christian Greinke via [email protected]