XSL-FO
POST https://api.pdfbroker.io/api/pdf/xslfo
This api request is for generating a pdf document from a ready made XSL-FO document.
Example
Example XSL-FO document
<?xml version="1.0" encoding="utf-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="simple" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm"> <fo:region-body margin-top="3cm"/> <fo:region-before extent="3cm"/> <fo:region-after extent="1.5cm"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="simple"> <fo:static-content flow-name="xsl-region-before"> <fo:external-graphic src="pdfbroker_logo.jpg" width="200px"></fo:external-graphic> </fo:static-content> <fo:flow flow-name="xsl-region-body"> <fo:block font-size="18pt" font-family="sans-serif" line-height="24pt" space-after.optimum="15pt" background-color="blue" color="white" text-align="center" padding-top="3pt"> XSL-FO Example file </fo:block> <!-- this defines normal text --> <fo:block> What is XSL-FO? </fo:block> <fo:list-block> <fo:list-item> <fo:list-item-label> <fo:block margin-left="5px">*</fo:block> </fo:list-item-label> <fo:list-item-body> <fo:block margin-left="20px">XSL-FO is a language for formatting XML data</fo:block> </fo:list-item-body> </fo:list-item> <fo:list-item> <fo:list-item-label> <fo:block margin-left="5px">*</fo:block> </fo:list-item-label> <fo:list-item-body> <fo:block margin-left="20px">XSL-FO stands for Extensible Stylesheet Language Formatting Objects</fo:block> </fo:list-item-body> </fo:list-item> <fo:list-item> <fo:list-item-label> <fo:block margin-left="5px">*</fo:block> </fo:list-item-label> <fo:list-item-body> <fo:block margin-left="20px">XSL-FO is a W3C Recommendation</fo:block> </fo:list-item-body> </fo:list-item> <fo:list-item> <fo:list-item-label> <fo:block margin-left="5px">*</fo:block> </fo:list-item-label> <fo:list-item-body> <fo:block margin-left="20px">XSL-FO is now formally named XSL</fo:block> </fo:list-item-body> </fo:list-item> </fo:list-block> <fo:block margin-top="20px" > XSL-FO is a Web Standard XSL-FO became a W3C Recommendation 15. October 2001. Formally named XSL. </fo:block> </fo:flow> <!-- closes the flow element--> </fo:page-sequence> <!-- closes the page-sequence --> </fo:root>
Example of request with body formatted as JSON with logo image file which is referenced in XSL-FO document added as resource.
{ "FoDocumentBase64String": "PD94bWwgdmVyc2lvbj0iMS4wI...shortened for readability", "Resources": { "pdfbroker_logo.jpg": "/9j/4AAQSkZJRgABAQEARwBHAA...shortened for readability" } }
Example of request with data formatted as application/form-data with one "foDocument" entry and image resource named "pdfbroker_logo.jpg" as referenced in XSL-FO document.
--98ed5959-260e-48b3-b63f-c98a52fe055e Content-Disposition: form-data; name=foDocument; filename=examplefodocument.xml; filename*=utf-8''examplefodocument.xml <?xml version="1.0" encoding="utf-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="simple" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm"> { content shortened for readability, view full XSL-FO document on XSL-FO tab} <!-- closes the flow element--> </fo:page-sequence> <!-- closes the page-sequence --> </fo:root> --98ed5959-260e-48b3-b63f-c98a52fe055e Content-Disposition: form-data; name=pdfbroker_logo.jpg; filename=pdfbroker_logo.jpg; filename*=utf-8''pdfbroker_logo.jpg {binary filecontent, removed for readability}