This step by step tutorial shows you how to render XSL FO to PDF in C#. XSL-FO file represents XML stylesheet formatting language. This code helps you export XSL FO to PDF in C#.
Steps to Render XSL FO to PDF in C#
- Setup Aspose.PDF for .NET from NuGet.org
- Add using directive for Aspose.PDF namespace
- Set license using SetLicense method
- Create an instance of Document class
- Pass XslFoLoadOptions object to Document object
- Save the output converted PDF file
The simple steps given above help convert XSL FO to PDF in C#. The .fo file is loaded in the document object while the document object constructor also gets XslFoLoadOptions object with default values. And finally, the output PDF file converted from the XSL FO file is saved using Save method of the document object.
Code to Render XSL FO to PDF in C#
The code above helps you export XSL FO to PDF in C# in just two lines of code. If you want to add XSL FO to PDF conversion in C# or .NET applications then this code will work perfectly in Windows, Web, or other .NET applications.