C# API for JSON to PDF Conversion
In order to convert JSON files to PDF format, we will use Aspose.Cells for .NET. It is a powerful API that allows you to generate spreadsheet documents from scratch. In addition, it lets you process and convert existing Excel files from within your .NET applications. You can either download the API or install it using NuGet.
PM> Install-Package Aspose.Cells
Convert JSON to PDF in C#
The following are the steps to convert a JSON file to PDF using C#.
- Create an instance of the Workbook class.
- Select the default Worksheet from the Worksheets collection.
- Load JSON data from file using File.ReadAllText(string) method.
- Create an instance of JsonLayoutOptions and set options.
- Import data from JSON to worksheet using JsonUtility.ImportData method with reference to Worksheet object and JSON data.
- Convert JSON to PDF by saving the workbook as PDF using Workbook.Save(string, SaveFormat.Auto) method.
The following code sample shows how to convert a JSON file to PDF.
Get a Free License
You can use Aspose.Cells for .NET without evaluation limitations using a temporary license.
In this article, you have learned how to import JSON data and convert it to PDF using C#. You can use the provided code sample within your .NET, .NET Core, Mono or Xamarin based applications. In addition, you can explore the documentation of Aspose.Cells for .NET. Also, you can post your queries on our forum.