English Indonesia Tiếng Việt عربي Español Italiano Türk فارسی Français Português Русский ไทย

PDF Document Generation in C#

Wordize Reporting for .NET — an innovative solution for programmatic PDF document generation that helps C# developers automate the creation of reports of any complexity. Integrate report generation into your C# projects and transform JSON, XML files into professional PDF documents.

Key benefits of PDF Report Generation in C#:

  • Quick integration with business processes through .NET API
  • Easy maintenance and updating of document templates
  • Built-in integration with external data sources in JSON, XML, CSV formats
  • Integration with any other data sources using collections of programming objects in C# code
  • Document templating using placeholder fields like '<<[field_name]>>' and LINQ Reporting Engine technology, allowing functional-style data manipulation
  • Detailed configuration of the PDF document generation process through the ReportBuilderOptions class
  • Ability to work with input/output streams for memory optimization

Automation Scenarios for PDF Documents

  • Programmatic generation of contracts with customer data
  • Creation of invoices and commercial proposals
  • Generation of financial reports based on accounting data
  • Formation of technical specifications based on project data

Create PDF File in C#

To understand how to create PDF files in C# using the Report Generation API, upload your template document and data file (XML, JSON, CSV) through the form. Specify the name of the data source object used in the template, and start the programmatic PDF file generation. After running the demo, download the created PDF document and verify the correct substitution of data from the specified source file.

C#
Run code
Upload document template
Upload data file
Select the target format from the list
using Wordize.Reporting;

var dataSource = new JsonDataSource("data.json");
ReportBuilder.BuildReport("Input.pdf", "Output.pdf", dataSource, "");
using Wordize.Reporting; var dataSource = new JsonDataSource("data.json"); ReportBuilder.BuildReport("Input.pdf", "Output.pdf", dataSource, ""); using Wordize.Reporting; using Wordize.Saving; var dataSource = new JsonDataSource("data.json"); var imageStreams = ReportBuilder.BuildReportToImages("Input.pdf", new ImageSaveOptions(SaveFormat.Pdf), new[] { dataSource }, new[] { "" }); foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i))) { using var _ = stream; stream.Position = 0; using var file = File.Create($"Output_{page + 1}.pdf"); stream.CopyTo(file); }
using Wordize.Reporting;

var dataSource = new XmlDataSource("data.xml");
ReportBuilder.BuildReport("Input.pdf", "Output.pdf", dataSource, "");
using Wordize.Reporting; var dataSource = new XmlDataSource("data.xml"); ReportBuilder.BuildReport("Input.pdf", "Output.pdf", dataSource, ""); using Wordize.Reporting; using Wordize.Saving; var dataSource = new XmlDataSource("data.xml"); var imageStreams = ReportBuilder.BuildReportToImages("Input.pdf", new ImageSaveOptions(SaveFormat.Pdf), new[] { dataSource }, new[] { "" }); foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i))) { using var _ = stream; stream.Position = 0; using var file = File.Create($"Output_{page + 1}.pdf"); stream.CopyTo(file); }
using Wordize.Reporting;

var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true });
ReportBuilder.BuildReport("Input.pdf", "Output.pdf", dataSource, "");
using Wordize.Reporting; var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true }); ReportBuilder.BuildReport("Input.pdf", "Output.pdf", dataSource, ""); using Wordize.Reporting; using Wordize.Saving; var dataSource = new CsvDataSource("data.csv", new CsvDataLoadOptions() { HasHeaders = true }); var imageStreams = ReportBuilder.BuildReportToImages("Input.pdf", new ImageSaveOptions(SaveFormat.Pdf), new[] { dataSource }, new[] { "" }); foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i))) { using var _ = stream; stream.Position = 0; using var file = File.Create($"Output_{page + 1}.pdf"); stream.CopyTo(file); }
Run code

How to generate reports in C#

  1. Install Wordize for .NET
  2. Add a reference to the library (import the library) in your C# project
  3. Specify document template and data source (JSON, XML, CSV, object collection in code)
  4. Generate document based on template and data

System Requirements

Our product is fully cross-platform and supports all major .NET implementations:

  • .NET ≥ 5.0
  • .NET Core ≥ 2.0
  • .NET Standard ≥ 2.0
  • .NET Framework ≥ 3.5
  • MonoMac
  • MonoAndroid
  • Xamarin

As far as .NET code doesn't depend on the underlying hardware or operating system, but only on a Virtual Machine, you are free to develop any kind of software for Windows, macOS, Android, iOS and Linux. Just make sure you have installed the corresponding version of .NET Framework, .NET Core, Windows Azure, Mono or Xamarin.

We recommend using Microsoft Visual Studio, Xamarin, and MonoDevelop integrated development environments to create C#, F#, VB.NET applications.

5%