Convert XBRL to PDF in C#

XBRL (eXtensible Business Reporting Language) file provides digital business reporting to exchange business information. It provides a way to communicate business and financial data such as balance sheets, cash flow statements, ledgers, etc. In various cases, we may need to extract and share XBRL data in PDF format. In this article, we will learn how to convert XBRL to PDF in C#.

The following topics shall be covered in this article:

  1. C# XBRL to PDF Converter API
  2. Convert XBRL to PDF
  3. Convert XBRL XML to PDF

C# XBRL to PDF Converter API

For converting XBRL to PDF documents, we will follow a two-step procedure. Firstly, we will be using the Aspose.Finance for .NET to convert XBRL to XLSX, and then we will convert the XLSX to a PDF document using Aspose.Cells for .NET APIs.

Please either download the DLLs of the APIs or install them using NuGet.

PM> Install-Package Aspose.Finance
PM> Install-Package Aspose.Cells

Convert XBRL to PDF using C#

We can easily convert the XBRL file (.xbrl) to a PDF document by following the steps given below:

  1. Firstly, load the XBRL file using the XbrlDocument class.
  2. Next, create an instance of the SaveOptions class and set the SaveFormat as XLSX.
  3. Then, convert XBRL to XLSX and save in a FileStream object using XbrlDocument.Save() method.
  4. After that, open the XLSX FileStream object using the Workbook class.
  5. Finally, call the Workbook.Save() method to save the document in PDF format. It takes the output file path and the SaveFormat type (PDF) as arguments.

The following code sample demonstrates how to convert XBRL to a PDF using C#.

Convert XBRL to PDF in C#

Convert XBRL to PDF.

Convert XBRL XML to PDF in C#

We can also convert the XBRL data from an XML file (.xml) to a PDF document by following the steps mentioned earlier. However, we just need to input the .xml file instead of the .xbrl file in the first step.

The following code sample demonstrates how to convert an XML file to a PDF document using C#.

Get a Free License

You can get a free temporary license to try the library without evaluation limitations.

Conclusion

In this article, we have learned how to convert an XBRL file to a PDF document. We have also seen how to save XBRL data from an XML file to a PDF document programmatically. Besides, you can learn more about Aspose.Finance for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also