Exemplo n.º 1
0
        public static SealPdfConverter Create(string assemblyDirectory)
        {
            SealPdfConverter result = null;
            //Check if an implementation is available in a .dll
            string applicationPath = string.IsNullOrEmpty(assemblyDirectory) ? Path.GetDirectoryName(Application.ExecutablePath) : assemblyDirectory;

            if (File.Exists(Path.Combine(applicationPath, "SealConverter.dll")))
            {
                try
                {
                    Assembly currentAssembly = AppDomain.CurrentDomain.Load("SealConverter");
                    Type     t    = currentAssembly.GetType("Seal.Converter.PdfConverter", true);
                    Object[] args = new Object[] { };
                    result = (SealPdfConverter)t.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, args);
                    result.ApplicationPath = applicationPath;
                    //Load related DLLs
                    Assembly.LoadFrom(Path.Combine(applicationPath, "wnvhtmltopdf.dll"));
                }
                catch (Exception ex) {
                    Debug.WriteLine(ex.Message);
                }
            }

            if (result == null)
            {
                result = new SealPdfConverter();
            }

            return(result);
        }
Exemplo n.º 2
0
        public SealPdfConverter GetDashboardPdfConverter()
        {
            var dashboardPdfConverter = SealPdfConverter.Create();

            dashboardPdfConverter.SetConfigurations(DashboardPdfConfigurations, null);
            return(dashboardPdfConverter);
        }
Exemplo n.º 3
0
        public static SealPdfConverter Create()
        {
            SealPdfConverter result = null;

            //Check if an implementation is available in a .dll
            if (File.Exists(Repository.Instance.SealConverterPath))
            {
                try
                {
                    string assembliesFolder = Repository.Instance.AssembliesFolder;
                    //Load related DLLs
                    Assembly.LoadFrom(Path.Combine(assembliesFolder, "WnvHtmlToPdf_NetCore.dll"));
                    Assembly.LoadFrom(Path.Combine(assembliesFolder, "WnvHtmlToPdfClient_NetCore.dll"));
                    Assembly currentAssembly = Assembly.LoadFrom(Repository.Instance.SealConverterPath);
                    Type     t    = currentAssembly.GetType("Seal.Converter.PdfConverter", true);
                    object[] args = new object[] { };
                    result = (SealPdfConverter)t.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, args);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            if (result == null)
            {
                result = new SealPdfConverter();
            }

            return(result);
        }
Exemplo n.º 4
0
        public static SealPdfConverter Create(string assemblyDirectory)
        {
            SealPdfConverter result = null;
            //Check if an implementation is available in a .dll
            string applicationPath = string.IsNullOrEmpty(assemblyDirectory) ? Path.GetDirectoryName(Application.ExecutablePath) : assemblyDirectory;
            if (File.Exists(Path.Combine(applicationPath, "SealConverter.dll")))
            {
                try
                {
                    Assembly currentAssembly = AppDomain.CurrentDomain.Load("SealConverter");
                    Type t = currentAssembly.GetType("SealPdfConverter.PdfConverter", true);
                    Object[] args = new Object[] { };
                    result = (SealPdfConverter)t.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, args);
                    result.ApplicationPath = applicationPath;
                }
                catch { }
            }

            if (result == null) result = new SealPdfConverter();
            
            return result;
        }
Exemplo n.º 5
0
        public static SealPdfConverter Create(string assemblyDirectory)
        {
            SealPdfConverter result = null;
            //Check if an implementation is available in a .dll
            string applicationPath = string.IsNullOrEmpty(assemblyDirectory) ? Helper.GetApplicationDirectory() : assemblyDirectory;

            if (File.Exists(Path.Combine(applicationPath, "SealConverter.dll")))
            {
                try
                {
                    Assembly currentAssembly = Assembly.LoadFrom(Path.Combine(applicationPath, "SealConverter.dll"));
                    //Load related DLLs
#if NETCOREAPP
                    Assembly.LoadFrom(Path.Combine(applicationPath, "WnvHtmlToPdf_NetCore.dll"));
                    Assembly.LoadFrom(Path.Combine(applicationPath, "WnvHtmlToPdfClient_NetCore.dll"));
#else
                    Assembly.LoadFrom(Path.Combine(applicationPath, "wnvhtmltopdf.dll"));
                    Assembly.LoadFrom(Path.Combine(applicationPath, "WnvHtmlToPdfClient.dll"));
#endif
                    Type     t    = currentAssembly.GetType("Seal.Converter.PdfConverter", true);
                    Object[] args = new Object[] { };
                    result = (SealPdfConverter)t.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, args);
                    result.ApplicationPath = applicationPath;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            if (result == null)
            {
                result = new SealPdfConverter();
            }

            return(result);
        }