Articles in this section

How to Configure the Signature Widget in Bold Reports ASP.NET Core

Published:
Updated:

To add the Signature widget to the Bold Reports .NET Core Report Designer, install the BoldReports.CRI.Signature NuGet package, register the extension at application startup, pass its metadata to the view, reference the signature scripts and styles, and enable EmbedImageData. The Signature item then appears in the designer toolbox so report authors can draw signatures on the canvas.

When to use this

Use these steps when you embed the Bold Reports Report Designer in an .NET Core application and you want report authors to add signature fields that end users can draw directly on the report. The Signature widget is a Custom Report Item (CRI), so it must be installed and registered before it shows in the toolbox.

Steps

1. Install the Signature NuGet package

Install the Custom Report Item (CRI) package for signatures. Open a terminal or the NuGet Package Manager and run:

dotnet add package BoldReports.CRI.Signature

2. Register the extension at application startup

Register the extension assembly so the report engine recognizes the Signature item. In Program.cs (or Startup.cs on older templates), add:

    using BoldReports.Web;
    using System.Collections.Generic;
    // Register the Signature extension assembly into the report designer
    ReportConfig.DefaultSettings = new ReportSettings().RegisterExtensions(new List<string>
    {
        "BoldReports.CRI.Signature"
    });

3. Pass the extension metadata to the view

Add the Signature item’s metadata to the controller that renders the designer, so the designer can show it in the toolbox. Update HomeController.cs (or your equivalent controller):

    using System.Collections.Generic;
    public IActionResult Index()
    {
        // Initialize the list for custom report item extensions
        var extensions = new List<BoldReports.Models.ReportDesigner.ReportItemExtensionsModule>();

        var signatureExtension = new BoldReports.Models.ReportDesigner.ReportItemExtensionsModule
        {
            Name = "ESignature",
            ClassName = "EJSignature",
            ImageClass = "customitem-signature",
            DisplayName = "Signature",
            Category = "Signatures"
        };

        extensions.Add(signatureExtension);
        ViewBag.ReportItemExtensions = extensions;

        return View();
    }

4. Reference the signature scripts and styles

The Signature widget needs its JavaScript and CSS files in the browser. Copy the signature extension files into your wwwroot folder (typically wwwroot/scripts/bold-reports/extension/), then reference them in _Layout.cshtml or the view that hosts the designer. Add link tags for signature.reportitem.css and signature.dialog.css, and script tags for signature.reportitem.js and signature.dialog.js, each pointing to that extension folder.

<!-- Signature Widget Styles -->
<link href="~/scripts/bold-reports/extension/signature.reportitem.css" rel="stylesheet" />
<link href="~/scripts/bold-reports/extension/signature.dialog.css" rel="stylesheet" />
<!-- Signature Widget Scripts -->
<script src="~/scripts/bold-reports/extension/signature.reportitem.js"></script>
<script src="~/scripts/bold-reports/extension/signature.dialog.js"></script>

5. Enable embedded image data

Signatures are captured as image data, so the report model must embed that data. In the designer’s Web API controller, set EmbedImageData to true:

    [HttpPost]
    public object PostDesignerAction(Dictionary<string, object> jsonResult)
    {
        var reportOption = ReportDesignerHelper.GetReportOptions(jsonResult);

        // Enable image data embedding for signature capture
        reportOption.ReportModel.EmbedImageData = true;

        return ReportDesignerHelper.ProcessDesigner(jsonResult, this, null);
    }

6. Preview and test the widget

  1. Run the application to open the Bold Reports Web Report Designer.
  2. Find the Signature item in the toolbox under the Signatures category.
  3. Drag the Signature item onto the design canvas.
  4. In the Properties panel, click Draw under Basic Settings to open the signature pad and test drawing.
    Signature widget in Designer canvas

Caption: Drag the Signature widget onto the canvas and access the Draw settings.

Result

The Signature item appears in the designer toolbox under Signatures. Report authors can drop it onto the canvas, draw a signature with the Draw option, and the drawn image is embedded in the report definition so it renders in preview and export.

Related articles

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied