Generate PDF Report (.NET Core/Framework)
Automated PDF report generation can be done using DynamicPDF ReportWriter product. Reports can be created from JSON data, business objects or a varity of data sources including Sql Server, Oracle or MySql databases.
How to Generate PDF Report
DynamicPDF Designer is used to create a PDF report template (DLEX file) and the ReportWriter lays out the data to create the PDF report. DynamicPDF Designer is a free tool that allows the creation of a report templates.
Steps to Generate PDF report
- Create a
DocumentLayout
object using a DLEX file as a template. - Create a
NameValueLayoutData
object and add the necessary data. - Call the
Layout
method on the DocumentLayout to create aDocument
object. - Invoke the
Draw
method on the Document to save the PDF.
Sample Code - C#
var jsonData = JsonConvert.DeserializeObject("ReportData.json");
DocumentLayout layoutReport = new DocumentLayout("SimpleReportWithCoverPage.dlex");
NameValueLayoutData layoutData = new NameValueLayoutData();
layoutData.Add("ReportCreatedFor", "Alex Smith");
layoutData.Add("Products", jsonData);
Document document = layoutReport.Layout(layoutData);
document.Draw("output.pdf");
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.
GitHub Example Project
Clone or view the example project at GitHub. This example on this page is in the Examples/CreatePDFReport.cs file.
DynamicPDF ReportWriter Information
More information on DynamicPDF Core Suite (ReportWriter) can be found on its webpage.
Available on Other Platforms
DynamicPDF ReportWriter PDF Library is also available for COM/AxtiveX platforms. Refer to the product page for more details.
- COM/ActiveX - DynamicPDF ReportWriter for COM/ActiveX