How to Update Doconut

Follow these steps to update from version 1.0.5.2 or below.

.NET Framework 4.7

Web.config Configuration

The viewer requires HttpHandler to be registered via web.config file. Depending on your IIS version it can be done using the following section defined in web.config.

Below IIS 7:

xml
<httpHandlers>
  <add verb="GET,POST" path="DocImage.axd" type="Doconut.DocImageHandler, Doconut" />
</httpHandlers>

IIS 7 and above:

xml
<handlers>
  <add name="DocImage" verb="GET,POST" path="DocImage.axd" type="Doconut.DocImageHandler, Doconut" />
</handlers>

Update Register in ASPX pages

Change the assembly registration in your ASPX pages.

Old:

aspx
<%@ Register Assembly="DocumentViewer" Namespace="DotnetDaddy.DocumentViewer" TagPrefix="asp" %>

New:

aspx
<%@ Register Assembly="Doconut" Namespace="Doconut" TagPrefix="asp" %>

Update Control Tag

Update the control tag from DocViewer to Viewer.

Old:

aspx
<asp:DocViewer ID="ctlDoc" runat="server"/>

New:

aspx
<asp:Viewer ID="ctlDoc" runat="server"/>

Update Namespaces

Doconut 24.3.0 renamed the namespaces. Add the new DLLs: Doconut.dll, Doconut.Formats.dll, Doconut.Configs.dll, and Doconut.Clouds.dll.

New Usings:

csharp
using Doconut;
using Doconut.Configs;
using Doconut.Clouds;

Initialization:

csharp
var viewer = new Viewer();

Package Dependencies

  • Newtonsoft.Json 13.0.3
  • System.Text.Encoding.CodePages 6.0.0
  • System.Text.Json 6.0.0

.NET Standard / Core

Update Namespaces

Doconut 24.3.0 renamed the namespaces. Add the new DLLs: Doconut.dll, Doconut.Formats.dll, Doconut.Configs.dll, and Doconut.Clouds.dll.

New Usings:

csharp
using Doconut;
using Doconut.Configs;
using Doconut.Clouds;

Initialization:

csharp
using System;

// Viewer instances are now obtained from a factory, DI container, or other provider.
// Replace the implementation of GetViewer with your actual acquisition logic.
Viewer GetViewer() => throw new NotImplementedException();

var viewer = GetViewer(); // obtain a Viewer instance

Package Dependencies

  • Microsoft.Extensions.Caching.Abstractions 3.1.10
  • SkiaSharp 2.88.6
  • Newtonsoft.Json 13.0.3
  • System.Drawing.Common 6.0.0
  • System.Text.Json 6.0.0
  • System.Text.Encoding.CodePages 7.0.0

.NET 6 or higher

Update Namespaces

Doconut 24.3.0 renamed the namespaces. Add the new DLLs: Doconut.dll, Doconut.Formats.dll, Doconut.Configs.dll, and Doconut.Clouds.dll.

New Usings:

csharp
// Current .NET 6 integration: Viewer comes from DI and document opening is asynchronous.
var token = await viewer.OpenDocumentAsync(path, new PdfConfig { AllowSearch = true });

Initialization:

csharp
app.MapPost("/api/open", async (Viewer viewer) =>
{
    // The token is opaque — hand it to the widget, never log or persist it.
    string token = await viewer.OpenDocumentAsync("wwwroot/files/Sample.pdf");
    return Results.Ok(new { token });
});

Package Dependencies

  • Microsoft.Extensions.Caching.Abstractions 3.1.10
  • Newtonsoft.Json 13.0.3
  • SkiaSharp 2.88.6
  • System.Drawing.Common 7.0.0
  • System.Text.Encoding.CodePages 7.0.0

Was this page helpful?