
To run it we pass the names of the XML, XSL and PDF files on the command line like this: dotnet run hello.xml hello.xsl hello-world.pdf The program can be compiled from the command line, linking Ibex like this:Ĭreate a new project class, for example, "hello" dotnet new console -name helloĮdit the Program.cs file created when the project was created and replace its contents with this: using ibex4 call the generate() method to create the PDF file.create streams for input of the XML and XSL, and output of the PDF.The C# program used in this example is: using ibex4 Ĭonsole.WriteLine( "usage:hello xml-file xsl-file pdf-file" ) įileStream xml = new FileStream( args, FileMode.Open, FileAccess.Read ) įileStream xsl = new FileStream( args, FileMode.Open, FileAccess.Read ) įileStream pdf = new FileStream( args, FileMode.Create, FileAccess.Write ) The XSL used in this example looks like this: īasically what this XSL does it output the element of the FO file, which contains the fo:layout-master-set defining the page structure, and then output each element from the XML inside an FO block element. And changing the XSL is simple because we don't need to recompile it and can just use a text editor to maintain it. If we add new elements to the XML which we want to appear in the PDF file, then we will need to change the XSL stylesheet, but we won't have to change the C# program. Using a stylesheet means that when the data changes (in the XML file) we do not have to make any changes to the C# program or the XSL stylesheet. It looks like this: Īn XSL stylesheet is used to transform the XML into XSL-FO syntax.

The XML used in this example contains text held in one or more paragraph elements. In this example we use an XML file containing the data we want to get into the PDF file, and and XSL stylesheet which transforms the XML into the FO syntax which Ibex understands. This example shows how to call Ibex from a C# program and create a PDF file from XML and XSL files. Ibex supports SVG images including transparency, linear and radial gradients, and SVG images which contain other bitmap images: Including cells which span multiple rows and columns, aligning data on decimal points regardless of font size, conditional headers and footers (for saying "continued on next page"), conditional borders at page breaks and lots more.īookmarks can be automatically generated using XSLT, including clickable page numbers which link to the correct page in the document:

Ibex supports complex table layouts like this: Ibex supports a wide range of layout functionality including page headers and footers, multi-column pages, page numbering, cross-referencing, footnotes, index creation and much more. Ibex helps you quickly create complex documents providing complete control over page layout and content. Ibex is a scalable standards-compliant PDF creation component for.
