# Convert XML to PDF Using XSL-FO Learn how to convert a XML document to PDF using XSL-FO with GroupDocs.Conversion for .NET. GroupDocs.Conversion for .NET allows you to convert XML files to PDF format using XSL-FO templates. This approach lets you define the layout and style of the PDF by transforming the XML content through an XSL-FO stylesheet. Follow this guide to perform the conversion seamlessly. ## Key Features - Convert XML to PDF with custom styles using XSL-FO. - Define PDF layout and formatting using XSL-FO templates. - Flexible and efficient for generating PDFs from structured XML data. ## Prerequisites Ensure you have the following ready before proceeding: 1. GroupDocs.Conversion for .NET installed in your project. 2. An XML file containing the data to convert. 3. An XSL-FO stylesheet that defines the PDF layout and design. 4. On .NET 6 and later, the [System.Drawing.Common](https://www.nuget.org/packages/System.Drawing.Common/4.7.3) 4.7.3 package in your project; on Linux, libgdiplus must also be installed. Without it, the conversion throws a `MissingDependencyException` that names the missing package. ## Code Example: XML to PDF Conversion The following code snippet demonstrates how to convert an XML file to PDF using an XSL-FO template: ```csharp // Load the XML file with the XSL-FO stylesheet using (var converter = new Converter("books.xml", (LoadContext loadContext) => new XmlLoadOptions { XslFoFactory = () => new FileStream("bookstore-pdf-template.xsl", FileMode.Open) })) { // Set the output format to PDF var options = new PdfConvertOptions(); // Perform the conversion converter.Convert("converted.pdf", options); }