7 Tools for Generating PDF Reports in ASP.NET Core

Discover 5 tools for generating PDF reports in ASP.NET Core: iText, QuestPDF, IronPDF, DinkToPdf, Telerik, DevExpress, and Syncfusion. Compare features, code examples, and licensing.

ASP.NET Core

7 Tools for Generating PDF Reports in ASP.NET Core

  • Sunday, May 25, 2025

Discover 5 tools for generating PDF reports in ASP.NET Core: iText, QuestPDF, IronPDF, DinkToPdf, Telerik, DevExpress, and Syncfusion. Compare features, code examples, and licensing.

Introduction

In enterprise applications, generating PDF reports is a critical requirement for everything from invoices and receipts to analytics dashboards and compliance documents. ASP.NET Core offers several robust libraries to streamline PDF creation, but choosing the right tool can be challenging. This guide explores five powerful tools for generating PDFs in ASP.NET Core, comparing their features, ease of use, and suitability for different scenarios. Whether you need simple text-based reports or complex, styled documents, you’ll find the right solution here.

1. iTextSharp/iText 7

Overview

iTextSharp (now succeeded by iText 7) is a mature, open-source library for creating and manipulating PDFs. It’s highly flexible, supporting advanced features like digital signatures, encryption, and PDF/A compliance.

Features

  • Create PDFs from scratch or modify existing ones.

  • Add tables, images, headers, footers, and watermarks.

  • Support for barcodes, forms, and accessibility tags (PDF/UA).

  • Licensed under AGPL (free for open-source projects) or commercial licenses.

Installation

dotnet add package itext7  

Code Example:

using iText.Kernel.Pdf;  
using iText.Layout;  
using iText.Layout.Element;  

public byte[] GeneratePdf()  
{  
    using var memoryStream = new MemoryStream();  
    var writer = new PdfWriter(memoryStream);  
    var pdf = new PdfDocument(writer);  
    var document = new Document(pdf);  

    // Add content  
    document.Add(new Paragraph("Hello, iText 7!"));  
    document.Add(new Table(new float[] { 1, 2 })  
        .AddCell("Name")  
        .AddCell("John Doe"));  

    document.Close();  
    return memoryStream.ToArray();  
}  

Pros & Cons

  • Pros: High customization, supports advanced PDF features.

  • Cons: Steep learning curve; AGPL licensing requires care for commercial use.

2. QuestPDF

Overview

QuestPDF is a modern, open-source library with a fluent API for designing PDFs. It’s ideal for developers who prefer declarative, code-first layouts.

Features

  • Fluent API for building complex layouts.

  • Built-in support for tables, grids, and dynamic content.

  • Live preview tool for debugging.

  • MIT Licensed.

Installation

dotnet add package QuestPDF  

Code Example

using QuestPDF.Fluent;  
using QuestPDF.Helpers;  
using QuestPDF.Infrastructure;  

public byte[] GeneratePdf()  
{  
    var document = Document.Create(container =>  
    {  
        container.Page(page =>  
        {  
            page.Size(PageSizes.A4);  
            page.Margin(2, Unit.Centimetre);  
            page.Content().Column(col =>  
            {  
                col.Item().Text("Hello, QuestPDF!").Bold();  
                col.Item().Table(table =>  
                {  
                    table.ColumnsDefinition(columns =>  
                    {  
                        columns.RelativeColumn();  
                        columns.RelativeColumn();  
                    });  
                    table.Cell().Text("Name");  
                    table.Cell().Text("John Doe");  
                });  
            });  
        });  
    });  

    return document.GeneratePdf();  
}  

Pros & Cons

  • Pros: Intuitive API, great for complex layouts, MIT license.

  • Cons: Limited PDF manipulation (e.g., cannot edit existing PDFs).

3. IronPDF

Overview

IronPDF is a commercial library that leverages Chromium to render HTML/CSS into PDFs. It’s perfect for converting Razor views or HTML templates to PDFs.

Features

  • HTML-to-PDF conversion with CSS/JavaScript support.

  • Add headers, footers, and page numbers.

  • Merge or split PDFs.

  • Requires a commercial license.

Installation

dotnet add package IronPdf  

Code Example

using IronPdf;  

public byte[] GeneratePdf()  
{  
    var renderer = new ChromePdfRenderer();  
    var pdf = renderer.RenderHtmlAsPdf("<h1>Hello, IronPDF!</h1><p>Name: John Doe</p>");  
    return pdf.BinaryData;  
}  

Pros & Cons

  • Pros: Simplifies HTML-to-PDF conversion, excellent CSS support.

  • Cons: Commercial licensing; Chromium dependency increases deployment size.

4. DinkToPdf

Overview

DinkToPdf is a wrapper around the wkhtmltopdf library, converting HTML to PDF using WebKit. It’s lightweight and open-source but requires native binaries.

Features

  • HTML/CSS to PDF conversion.

  • Supports headers, footers, and TOC generation.

  • MIT Licensed.

Installation

  1. Install the NuGet package:

dotnet add package DinkToPdf  
  1. Download wkhtmltopdf binaries for your OS from wkhtmltopdf.org.

Code Example:

using DinkToPdf;  
using DinkToPdf.Contracts;  

public class PdfService  
{  
    private readonly IConverter _converter;  
    public PdfService(IConverter converter) => _converter = converter;  

    public byte[] GeneratePdf()  
    {  
        var html = "<h1>Hello, DinkToPdf!</h1><p>Name: John Doe</p>";  
        var doc = new HtmlToPdfDocument()  
        {  
            GlobalSettings = {  
                ColorMode = ColorMode.Color,  
                Orientation = Orientation.Portrait,  
                PaperSize = PaperKind.A4  
            },  
            Objects = { new ObjectSettings { HtmlContent = html } }  
        };  
        return _converter.Convert(doc);  
    }  
}  

Pros & Cons

  • Pros: Lightweight, accurate HTML rendering.

  • Cons: Dependency on native binaries; limited to HTML-to-PDF.

5. Syncfusion PDF Library

Overview

Syncfusion’s PDF Library is a commercial toolkit for creating, editing, and merging PDFs. It offers a comprehensive API for enterprise-grade needs.

Features

  • Create PDFs from scratch or templates.

  • Add tables, charts, and barcodes.

  • PDF/A compliance and digital signatures.

  • Free community license for small businesses.

Installation

dotnet add package Syncfusion.Pdf.Net.Core  

Code Example

using Syncfusion.Pdf;  
using Syncfusion.Pdf.Grid;  

public byte[] GeneratePdf()  
{  
    using var document = new PdfDocument();  
    var page = document.Pages.Add();  
    var graphics = page.Graphics;  

    // Add text  
    graphics.DrawString("Hello, Syncfusion!", new PdfStandardFont(PdfFontFamily.Helvetica, 20), PdfBrushes.Black, new PointF(10, 10));  

    // Add a table  
    var grid = new PdfGrid();  
    grid.DataSource = new List<object> { new { Name = "John Doe" } };  
    grid.Draw(page, new PointF(10, 50));  

    using var stream = new MemoryStream();  
    document.Save(stream);  
    return stream.ToArray();  
}  

Pros & Cons

  • Pros: Feature-rich, excellent documentation.

  • Cons: Commercial licensing; steep learning curve.

6. Telerik Reports

Overview

Telerik Reports by Progress Software is a powerful reporting solution for ASP.NET Core, offering a visual designer, rich data visualization, and seamless PDF export. It’s ideal for enterprise applications needing pixel-perfect reports.

Features

  • Drag-and-drop report designer (desktop and web-based).

  • Support for charts, gauges, barcodes, and sub-reports.

  • Export to PDF, Excel, HTML, and more.

  • Integration with Telerik Report Server for centralized management.

  • Requires a commercial license.

Installation

dotnet add package Telerik.Reporting 
dotnet add package Telerik.ReportViewer.AspNetCore
Code Example
// Define a report  
public class SalesReport : Telerik.Reporting.Report  
{  
    public SalesReport()  
    {  
        var dataSource = new ObjectDataSource();  
        dataSource.DataSource = SalesService.GetData();  

        var report = new Report();  
        report.DataSource = dataSource;  

        var textBox = new TextBox();  
        textBox.Value = "Sales Report";  
        report.Items.Add(textBox);  

        var table = new Table();  
        table.DataSource = dataSource;  
        table.Columns.Add(new TableColumn("Product"));  
        table.Columns.Add(new TableColumn("Revenue"));  
        report.Items.Add(table);  
    }  
}  

// Export to PDF  
var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();  
var result = reportProcessor.RenderReport("PDF", new SalesReport(), null);  
File.WriteAllBytes("SalesReport.pdf", result.DocumentBytes);  
Pros & Cons
  • Pros: Visual designer, enterprise-grade features, Telerik ecosystem integration.

  • Cons: Expensive licensing; steep learning curve.

7. DevExpress Reports

Overview

DevExpress Reports is a feature-rich reporting suite with a focus on performance and customization. It’s widely used in enterprise environments for creating complex, data-driven PDF reports.

Features

  • Visual Studio-integrated report designer.

  • Dashboard-style reports with charts, pivot grids, and sparklines.

  • PDF export with compression, encryption, and digital signatures.

  • Requires a commercial license.

Installation

dotnet add package DevExpress.AspNetCore.Reporting  
Code Example
// Create a report class  
public class InvoiceReport : XtraReport  
{  
    public InvoiceReport()  
    {  
        var dataSource = new List<Invoice> { /* Load data */ };  
        this.DataSource = dataSource;  

        var detailBand = new DetailBand { Height = 50 };  
        var productNameLabel = new XRLabel { Location = new Point(0, 0) };  
        productNameLabel.DataBindings.Add("Text", null, "ProductName");  
        detailBand.Controls.Add(productNameLabel);  

        this.Bands.Add(detailBand);  
    }  
}  

// Export to PDF  
var report = new InvoiceReport();  
report.ExportToPdf("InvoiceReport.pdf");  
Pros & Cons
  • Pros: High-performance rendering, extensive customization, deep data analysis.

  • Cons: Licensing costs; complex setup for advanced features.

Comparison Table

ToolLicenseStrengthsWeaknesses
iText 7AGPL/CommercialAdvanced PDF editing, complianceComplex API, licensing overhead
QuestPDFMITModern API, code-first layoutsNo visual designer
IronPDFCommercialHTML-to-PDF simplicityChromium dependency
DinkToPdfMITLightweight, HTML renderingNative binary dependency
SyncfusionCommercialEnterprise features, templatesLicensing cost
Telerik ReportsCommercialVisual designer, Telerik integrationHigh cost
DevExpressCommercialHigh customization, performanceExpensive, complex

Choosing the Right Tool

  • For Visual DesignersTelerik Reports or DevExpress.

  • For HTML/CSS WorkflowsIronPDF or DinkToPdf.

  • For Code-First FlexibilityQuestPDF or iText 7.

  • For Enterprise EcosystemsSyncfusionTelerik, or DevExpress.

Conclusion

With the addition of Telerik Reports and DevExpress, ASP.NET Core developers now have two more robust options for enterprise-level PDF reporting. These tools excel in environments requiring visual design interfaces, complex data visualization, and seamless integration with existing ecosystems.

Final Recommendations:

  • Startups/SMBs: Use QuestPDF (free) or DinkToPdf.

  • Enterprises: Invest in TelerikDevExpress, or Syncfusion for scalability and support.

  • Compliance NeedsiText 7 for PDF/A or digital signatures.

Evaluate your project’s requirements, licensing constraints, and scalability needs to make the best choice.

Contact Facile Team

Signup for monthly updates and stay in touch!

Subscribe to Facile Technolab's monthly newsletter to receive updates on our latest news, offers, promotions, resources, source code, jobs and other exciting updates.