Usando su licencia Doconut

Instrucciones para instalar y activar su licencia.

Para saber cómo usar una licencia Doconut, siga las instrucciones a continuación para diferentes plataformas .NET.

Instalación de licencia Doconut

.NET Framework

Detección automática de licencia

Doconut puede detectar automáticamente licencias si se colocan dentro de la carpeta bin del proyecto.

Agregar licencia predeterminada manual

Si prefiere agregar la licencia manualmente, las siguientes opciones están disponibles:

Agregar licencia por ruta de archivo

Este método usa la sobrecarga Viewer.DoconutLicense(string licencePath) para agregar una licencia especificando la ruta al archivo de licencia.

C#
var licensePath = "path/to/your/license.lic";
Viewer.DoconutLicense(licensePath);

Agregar licencia por flujo

Este método usa la sobrecarga Viewer.DoconutLicense(Stream licenseStream) para agregar una licencia usando un flujo.

C#
using (var licenseStream = new FileStream("path/to/your/license", FileMode.Open))
{
    Viewer.DoconutLicense(licenseStream);
}

Agregar licencia por documento XML

Este método usa la sobrecarga Viewer.DoconutLicense(XMLDocument licence) para agregar una licencia usando un documento XML.

C#
var xmlDoc = new XmlDocument();
xmlDoc.Load("path/to/your/license.xml");
Viewer.DoconutLicense(xmlDoc);

Agregar licencia de complemento por ruta de archivo

Este método usa la sobrecarga Viewer.SetLicensePlugin(string pathPluginLicence) para agregar una licencia de complemento especificando la ruta al archivo de licencia del complemento.

C#
var pluginLicensePath = "path/to/your/plugin-license.lic";
Viewer.SetLicensePlugin(pluginLicensePath);

Agregar licencia de complemento por flujo

Este método usa la sobrecarga Viewer.SetLicensePlugin(Stream pluginLicence) para agregar una licencia de complemento usando un flujo.

C#
using (var pluginLicenseStream = new FileStream("path/to/your/plugin-license.lic", FileMode.Open))
{
    Viewer.SetLicensePlugin(pluginLicenseStream);
}

Agregar licencia de complemento por documento XML

Este método usa la sobrecarga Viewer.SetLicensePlugin(XMLDocument xmlPluginLicence) para agregar una licencia de complemento usando un documento XML.

C#
var pluginXmlDoc = new XmlDocument();
pluginXmlDoc.Load("path/to/your/plugin-license.xml");
Viewer.SetLicensePlugin(pluginXmlDoc);

.NET Standard/Core and .NET 6 and higher

Detección automática de licencia

Doconut puede detectar automáticamente licencias si se colocan dentro de la carpeta wwwroot del proyecto.

Para inicializar docViewer con detección automática de licencia, use la siguiente línea:

C#
var docViewer = new Viewer(_cache, _accessor);

Agregar licencia predeterminada manual

Puede especificar manualmente la ruta a un único archivo de licencia predeterminada al inicializar el visor.

C#
var licenseFilePath = Path.Combine(_hostingEnvironment.WebRootPath, "path/to/your/license");
var docViewer = new Viewer(_cache, _accessor, licenseFilePath);

Agregar licencia por flujo

Este método usa la sobrecarga Viewer.DoconutLicense(Stream licenseStream) para agregar una licencia usando un flujo.

C#
using (var licenseStream = new FileStream("path/to/your/license", FileMode.Open))
{
    Viewer.DoconutLicense(licenseStream);
}

Agregar licencia por documento XML

Este método usa la sobrecarga Viewer.DoconutLicense(XMLDocument licence) para agregar una licencia usando un documento XML.

C#
var xmlDoc = new XmlDocument();
xmlDoc.Load("path/to/your/license.xml");
Viewer.DoconutLicense(xmlDoc);

Licencias de complemento múltiples predeterminadas manuales

Si necesita especificar múltiples licencias, puede proporcionar una lista de rutas de archivo a la inicialización del visor.

C#
List<string> licenseFilePaths = new List<string>
{
    Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.Viewer.lic"),
    Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.Viewer.Annotation.lic"),
    Path.Combine(_hostingEnvironment.WebRootPath, "Doconut.Viewer.Search.lic")
};
var docViewer = new Viewer(_cache, _accessor, licenseFilePaths);

Agregar licencia de complemento por flujo

Este método usa la sobrecarga Viewer.SetLicensePlugin(Stream pluginLicence) para agregar una licencia de complemento usando un flujo.

C#
using (var pluginLicenseStream = new FileStream("path/to/your/plugin-license.lic", FileMode.Open))
{
    Viewer.SetLicensePlugin(pluginLicenseStream);
}

Agregar licencia de complemento por documento XML

Este método usa la sobrecarga Viewer.SetLicensePlugin(XMLDocument xmlPluginLicence) para agregar una licencia de complemento usando un documento XML.

C#
var pluginXmlDoc = new XmlDocument();
pluginXmlDoc.Load("path/to/your/plugin-license.xml");
Viewer.SetLicensePlugin(pluginXmlDoc);

Protegiendo su archivo de licencia

Para proteger su archivo de licencia Doconut (.lic), es esencial seguir las mejores prácticas de seguridad de archivos. Guarde el archivo de licencia en un directorio seguro con acceso restringido, asegurándose de que solo usuarios o servicios autorizados puedan leerlo.