How to Render XSL FO to PDF in C#

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#

  1. Setup Aspose.PDF for .NET from NuGet.org
  2. Add using directive for Aspose.PDF namespace
  3. Set license using SetLicense method
  4. Create an instance of Document class
  5. Pass XslFoLoadOptions object to Document object
  6. 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.

 English