Examples

Generate PDF Report (.NET Core/Framework)

Use DynamicPDF Designer combined with DynamicPDF ReportWriter to automate PDF report generation. Create reports from JSON data, business objects, or a variety of data sources including SQL Server, Oracle, and MySQL databases.

How to Generate PDF Report

DynamicPDF Designer creates PDF report templates (DLEX files) and then ReportWriter combines the data and DLEX to layout and create a PDF report.

DynamicPDF Designer is a free graphical tool to create DLEX reports. Refer to Designer - Quick Tour for more information.

Steps to Generate PDF report

  1. Create a DocumentLayout object using a DLEX file as a template.
  2. Create a NameValueLayoutData object and add the necessary data.
  3. Call the Layout method on the DocumentLayout to create a Document object.
  4. Invoke the Draw method on the Document to save the PDF.

Sample Code - C#

string data = File.ReadAllText(Util.GetPath("Resources/Data/SimpleReportWithCoverPage.json"));
var jsonData = JsonConvert.DeserializeObject(data);
DocumentLayout layoutReport = new DocumentLayout(Util.GetPath("Resources/DLEXs/SimpleReportWithCoverPage.dlex"));

NameValueLayoutData layoutData = new NameValueLayoutData();
layoutData.Add("ReportCreatedFor", "Alex Smith");
layoutData.Add("Products", jsonData);

Document document = layoutReport.Layout(layoutData);
document.Draw(Util.GetPath("Output/report-output-example.pdf"));

GitHub Project

Clone or view the example project at GitHub. This example on this page is in the Examples/GeneratePDFReport.cs file.

Clone or View Example Project on GitHub

Getting Started

NuGet Package

DynamicPDF Generator is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The easiest way to install the DynamicPDF Core Suite package is through the Visual Studio Package Manager. You can also download directly from NuGet.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF ReportWriter Information

More information on DynamicPDF Core Suite (ReportWriter) can be found on its webpage.

DynamicPDF Designer Information

More information on DynamicPDF Designer can be found on the DynamicPDF API website.

Available on Other Platforms

DynamicPDF ReportWriter PDF Library is also available for COM/AxtiveX platforms. Refer to the product page for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!