Skip to content

Instantly share code, notes, and snippets.

Render XSL-FO File Format to PDF in C#. The steps to achieve this conversion are elaborated here: https://kb.conholdate.com/total/net/how-to-render-xsl-fo-to-pdf-in-c-sharp/
using System;
//Add reference to Aspose.PDF for .NET API
//Use the following namespace to render XSL-FO file format to PDF format
using Aspose.Pdf;
namespace RenderXSLFOToPDF
{
class Program
{
static void Main(string[] args)
{
//Set license before rendering XSL-FO file type to PDF file
Aspose.Pdf.License AsposePDFLicense = new Aspose.Pdf.License();
AsposePDFLicense.SetLicense(@"c:\asposelicense\license.lic");
//Load XSL-Fo file using XSL Fo load options
Document InputXSLFODocument = new Document("InputXSLFODocument.fo", new XslFoLoadOptions());
//Save the PDF file converted from XSL-FO document
InputXSLFODocument.Save("OutputPDFConvertedFromXSLFOFile.pdf");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment