Setup in .NET Framework

Web.config Configuration

Register the HttpHandler in your web.config file.

Below IIS 7
<httpHandlers>
  <add verb="GET,POST" path="DocImage.axd" type="Doconut.DocImageHandler, Doconut" />
</httpHandlers>
IIS 7 and above
<handlers>
  <add name="DocImage" verb="GET,POST" path="DocImage.axd" type="Doconut.DocImageHandler, Doconut" />
</handlers>

Add Licenses

Doconut automatically detects licenses in the root folder, or you can add them manually.

Manual License Path
var licenseFilePath = Server.MapPath("~/Doconut.Viewer.lic");
var docViewer = new Viewer(licenseFilePath);

Configuration for web.config

The following configuration entries are necessary for the web.config file to ensure compatibility with Doconut and the .NET Framework.

web.config
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="8.0.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Drawing.Common" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="MessagePack" publicKeyToken="9c7f9b36b37eaddf" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.5.140.0" newVersion="2.5.140.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.4.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Required NuGet Packages

To ensure your project is fully compatible with Doconut and the .NET Framework, the following NuGet packages need to be included:

  • MessagePack - Version 2.5.140
  • MessagePack.Annotations - Version 2.5.140
  • Microsoft.Bcl.AsyncInterfaces - Version 8.0.0
  • Microsoft.NET.StringTools - Version 17.6.3
  • System.Collections.Immutable - Version 6.0.0
  • System.Drawing.Common - Version 6.0.0
  • System.Memory - Version 4.5.5
  • System.Reflection.Emit - Version 4.7.0
  • System.Reflection.Emit.Lightweight - Version 4.7.0
  • System.Security.Cryptography.Pkcs - Version 8.0.0
  • System.Text.Encoding.CodePages - Version 8.0.0
  • System.Text.Encodings.Web - Version 8.0.0
  • System.Text.Json - Version 8.0.3

Render Configuration Options

You can configure the rendering behavior using the following options:

  • CadConfig: Used for DWG, DXF, and DGN files.
  • EmailConfig: Used for EML, EMLX, and MSG files.
  • EpubConfig: Used for EPUB files.
  • ExcelConfig: Used for Excel and CSV files.
  • MhtConfig: Used for MHT files.
  • PptConfig: Used for PowerPoint files.
  • ProjectConfig: Used for MPP files.
  • PsdConfig: Used for PSD files.
  • TxtConfig: Used for TXT files.
  • TiffConfig: Used for TIFF files.
Example usage
var config = new CadConfig { DefaultRender = false }; // or true

Custom Fonts in Word Documents

The FontFolders property in the WordConfig class specifies custom directories where the application will search for fonts.

Usage
var config = new WordConfig
{
    FontFolders = new string[] { "C:\\CustomFonts", "D:\\SharedFonts" }
};

Update Regarding AjaxControlToolkit in NuGet Package

We have made changes to our NuGet package to improve compatibility. AjaxControlToolkit will no longer be included. Users are advised to manually install AjaxControlToolkit version 4.1.50508 into their projects.

Important Update for Doconut 25.2.0

It is essential to update the System.Text.Json package to version 8.0.5 in all your projects.

Email Encoding

The EmailEncoding property in the EmailConfig class specifies the preferred encoding for both the email's subject and body.

Usage
var emailConfig = new EmailConfig {
    EmailEncoding = Encoding.UTF8 // Set preferred email encoding
};

Subject & Body Encoding

The SubjectEncoding and BodyEncoding properties in the EmailConfig class define the encoding used for the subject and body of an email, respectively.

Usage
var emailConfig = new EmailConfig {
    SubjectEncoding = Encoding.UTF8, // Set encoding for the subject
    BodyEncoding = Encoding.UTF8     // Set encoding for the body
};