การตั้งค่าใน .NET Framework

การกำหนดค่า Web.config

ลงทะเบียน HttpHandler ในไฟล์ web.config ของคุณ.

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>

เพิ่มใบอนุญาต

Doconut ตรวจจับใบอนุญาตในโฟลเดอร์รากโดยอัตโนมัติ หรือคุณสามารถเพิ่มด้วยตนเอง.

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

การกำหนดค่าสำหรับ web.config

รายการการกำหนดค่าต่อไปนี้จำเป็นสำหรับไฟล์ web.config เพื่อให้แน่ใจว่ามีความเข้ากันได้กับ Doconut และ .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>

แพ็กเกจ NuGet ที่จำเป็น

เพื่อให้แน่ใจว่าโครงการของคุณเข้ากันได้อย่างเต็มที่กับ Doconut และ .NET Framework จำเป็นต้องรวมแพ็กเกจ NuGet ต่อไปนี้:

  • 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

ตัวเลือกการกำหนดค่าการแสดงผล

คุณสามารถกำหนดพฤติกรรมการแสดงผลโดยใช้ตัวเลือกต่อไปนี้:

  • CadConfig: ใช้สำหรับไฟล์ DWG, DXF, และ DGN.
  • EmailConfig: ใช้สำหรับไฟล์ EML, EMLX, และ MSG.
  • EpubConfig: ใช้สำหรับไฟล์ EPUB.
  • ExcelConfig: ใช้สำหรับไฟล์ Excel และ CSV.
  • MhtConfig: ใช้สำหรับไฟล์ MHT.
  • PptConfig: ใช้สำหรับไฟล์ PowerPoint.
  • ProjectConfig: ใช้สำหรับไฟล์ MPP.
  • PsdConfig: ใช้สำหรับไฟล์ PSD.
  • TxtConfig: ใช้สำหรับไฟล์ TXT.
  • TiffConfig: ใช้สำหรับไฟล์ TIFF.
Example usage
var config = new CadConfig { DefaultRender = false }; // or true

แบบอักษรที่กำหนดเองในเอกสาร Word

คุณสมบัติ FontFolders ในคลาส WordConfig ระบุไดเรกทอรีที่กำหนดเองที่แอปพลิเคชันจะค้นหาแบบอักษร.

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

อัปเดตเกี่ยวกับ AjaxControlToolkit ในแพ็กเกจ NuGet

เราได้ทำการเปลี่ยนแปลงในแพ็กเกจ NuGet ของเราเพื่อปรับปรุงความเข้ากันได้ AjaxControlToolkit จะไม่ถูกรวมอยู่แล้ว ผู้ใช้ควรติดตั้ง AjaxControlToolkit เวอร์ชัน 4.1.50508 ด้วยตนเองในโครงการของตน.

อัปเดตสำคัญสำหรับ Doconut 25.2.0

จำเป็นอย่างยิ่งที่จะอัปเดตแพ็กเกจ System.Text.Json เป็นเวอร์ชัน 8.0.5 ในทุกโครงการของคุณ.

การเข้ารหัสอีเมล

คุณสมบัติ EmailEncoding ในคลาส EmailConfig ระบุการเข้ารหัสที่ต้องการสำหรับหัวเรื่องและเนื้อหาของอีเมล.

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

การเข้ารหัสหัวเรื่องและเนื้อหา

คุณสมบัติ SubjectEncoding และ BodyEncoding ในคลาส EmailConfig กำหนดการเข้ารหัสที่ใช้สำหรับหัวเรื่องและเนื้อหาของอีเมลตามลำดับ.

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

การสนับสนุนวัฒนธรรมของ Word Viewer

คุณสมบัติ DocumentCulture ในคลาส WordConfig ช่วยให้คุณกำหนดวัฒนธรรมสำหรับไฟล์ DOC และ DOCX อย่างชัดเจน สิ่งนี้ทำให้แน่ใจว่าข้อมูลที่แปลเป็นภาษาท้องถิ่น เช่น วันที่ สกุลเงิน และตัวเลข จะถูกแสดงผลอย่างแม่นยำเหมือนใน Microsoft Word ซึ่งเป็นประโยชน์อย่างยิ่งสำหรับภาษาที่มีข้อกำหนดการจัดรูปแบบเฉพาะ.

Usage
var config = new WordConfig { DocumentCulture = "he-IL" }; // Hebrew (Israel)
var config = new WordConfig { DocumentCulture = "ar-SA" }; // Arabic (Saudi Arabia)
var config = new WordConfig { DocumentCulture = "th-TH" }; // Thai (Thailand)
var config = new WordConfig { DocumentCulture = "ja-JP" }; // Japanese (Japan)