Steps to Generate PDF Reports

Step 1: HTML Templates

Create HTML templates and include placeholders for data.

JavaScript Pivot Table Customization
JavaScript Spreadsheet XLSX Pivot Table Layout

Step 2: Bind HTML Templates with Data

Use the Stubble.Core package and its StubbleBuilder class to bind the template. // Bind the template to data
var builder = new Stubble.Core.Builders.StubbleBuilder();
var boundTemplate = builder.Build().Render(TemplatePath, new { Query = products });

Steps to Generate PDF Reports

Step 3: Convert Bound HTML to PDF

Use GcHtmlRenderer to pass the bound HTML template and render it to PDF.using GrapeCity.Documents.Html;
// Render the bound HTML
using (var re = new GcHtmlRenderer(boundTemplate))

Documents for PDF Documentation
Documents for PDF Documentation

Step 4: Customize a PDF

Add margins, headers, and footers to the PDF file while converting the bound HTML template using GcHtmlRenderer.

Try rendering the HTML template

Render a report with the list of products from the standard NWind sample database using a {{mustache}} HTML template.

Read the blog Try the Demo View Documentation

GrapeCity Documents is Trusted by the World’s
Leading Companies

Trusted by the World’s Leading Companies