Skip to content

XSL-FO API

Generate PDF documents from pre-formatted XSL-FO documents using PdfBroker.io. Submit your complete XSL-FO markup and receive a PDF in return.

Endpoint

POST https://api.pdfbroker.io/api/pdf/xslfo

JSON Request Format

Submit the XSL-FO document as a Base64-encoded string with optional resources:

{
    "foDocumentBase64String": "PD94bWwgdmVyc2lvbj0i...",
    "resources": {
        "logo.png": "iVBORw0KGgoAAAANSUhEU..."
    }
}

Multipart/Form-Data Format

Submit the XSL-FO document and any referenced resources as binary attachments:

curl -X POST https://api.pdfbroker.io/api/pdf/xslfo \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -F "foDocument=@template.fo" \
  -F "logo.png=@logo.png"

XSL-FO Document Example

A complete XSL-FO document demonstrating page layout, headers, text formatting, and list structures:

<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="A4"
      page-width="210mm" page-height="297mm"
      margin="10mm">
      <fo:region-body margin="20mm" />
      <fo:region-before extent="20mm" />
    </fo:simple-page-master>
  </fo:layout-master-set>

  <fo:page-sequence master-reference="A4">
    <fo:static-content flow-name="xsl-region-before">
      <fo:block text-align="center">
        <fo:external-graphic src="logo.png" content-height="15mm" />
      </fo:block>
    </fo:static-content>

    <fo:flow flow-name="xsl-region-body">
      <fo:block font-size="14pt" font-weight="bold"
        space-after="5mm">
        Getting Started with XSL-FO
      </fo:block>
      <fo:block font-size="11pt" space-after="3mm">
        XSL-FO allows you to create precisely formatted
        PDF documents from XML data.
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Note

See the Swagger documentation for the complete API specification. New to XSL-FO? Start with our XSL-FO tutorial.