Beispiel #1
0
        static NativeMethods()
        {
            // First try the custom resolving mechanism.

            string fileName = PdfiumResolver.GetPdfiumFileName();

            if (fileName != null && File.Exists(fileName) && LoadLibrary(fileName) != IntPtr.Zero)
            {
                return;
            }

            // Load the platform dependent Pdfium.dll if it exists.

            var executableDomainFolder = AppDomain.CurrentDomain.RelativeSearchPath;

            if (TryLoadNativeLibrary(executableDomainFolder))
            {
                return;
            }

            var pdfiumViewerFolder = Path.GetDirectoryName(typeof(NativeMethods).Assembly.Location);

            if (TryLoadNativeLibrary(pdfiumViewerFolder))
            {
                return;
            }

            var uriCodeBase     = new Uri(Assembly.GetExecutingAssembly().CodeBase);
            var clickOnceFolder = Path.GetDirectoryName(uriCodeBase.LocalPath.ToString());

            TryLoadNativeLibrary(clickOnceFolder);
        }
Beispiel #2
0
        static NativeMethods()
        {
            // First try the custom resolving mechanism.

            string fileName = PdfiumResolver.GetPdfiumFileName();

            if (fileName != null && File.Exists(fileName) && LoadLibrary(fileName) != IntPtr.Zero)
            {
                return;
            }

            // Load the platform dependent Pdfium.dll if it exists.

            if (!TryLoadNativeLibrary(AppDomain.CurrentDomain.RelativeSearchPath))
            {
                TryLoadNativeLibrary(Path.GetDirectoryName(typeof(NativeMethods).Assembly.Location));
            }
        }
Beispiel #3
0
        static NativeMethods()
        {
            // First try the custom resolving mechanism.

            string fileName = PdfiumResolver.GetPdfiumFileName();

            if (fileName != null && File.Exists(fileName) && LoadLibrary(fileName) != IntPtr.Zero)
            {
                return;
            }

            // Load the platform dependent Pdfium.dll if it exists.

            ////////if (!TryLoadNativeLibrary(AppDomain.CurrentDomain.RelativeSearchPath))
            ////////    TryLoadNativeLibrary(Path.GetDirectoryName(typeof(NativeMethods).Assembly.Location));



            string platform = "x86"; //(IntPtr.Size == 4 ? "x86" : "x64")
            string pathDllInResourceAssembly = @"Kit\DLL\" + platform + @"\pdfium.dll";
            bool   ok = loadDynamicDll("PdfiumViewer", platform, pathDllInResourceAssembly, "pdfium.dll") != IntPtr.Zero;
        }