Unable to load DLL 'DPDFRenderNative_x64'

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v4)  /  Re: Unable to load DLL 'DPDFRenderNative_x64'

DynamicPDF PrintManager for .NET (v4) Forum

I am facing the following exception after deploying my application on the server 'Unable to load DLL 'DPDFRenderNative_x64'. I know in your documentation you have  mentioned to put the dll into the bin folder of the application, but in our application there is not a single bin folder, there are many different folder and a folder from where all the different .NET DLLs are being referenced.  Can you please let me know where else can i  add this native DLL apart from the bin folder.
Posted by a ceTe Software moderator
Hi,

Please place the native DLL (DPDFRenderNative_x64.dll or DPDFRenderNative_x86.dll) in the same folder as the .NET DLL (DynamicPDF.Rasterizer.XXXX.dll).

Thanks,
ceTe Software Support Team
What to do if the .NET DLL(DynamicPDF) has been put into  GAC .
Posted by a ceTe Software moderator
Hello,

Here is one method that will likely work for you. Set your own current directory through code to a directory containing the native DLL. Then make a call to our library that loads the native DLL, such as the PrintJob constructor. You can then set the current directory back to the original path if it is needed by something else in your applications. Please not that this only needs to be done the first time our library is used.
 
Here is a code sample:

           String defaultCurrentDir = System.IO.Directory.GetCurrentDirectory();
            //Set the current directory and load the native DLL file.
            System.IO.Directory.SetCurrentDirectory(@"Folder path");
            PrintJob printJob = new PrintJob("Printer name", @"Input PDF file path", 1, 1);
            //Once the native DLL is loaded you can change it back to original.
            System.IO.Directory.SetCurrentDirectory(defaultCurrentDir);
            printJob.Print();

We are continuing to look into this and will post an update if we find an alternate or preferred way to do this.

Thanks,
ceTe Software Support Team
Posted by a ceTe Software moderator
Hello,
 
Here is another method to load the native DLL which is among the list provided in the link here. Please refer to the documentation provided in the link above and use it accordingly in your application.

Below is the code sample.

    [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool SetDllDirectory(string lpPathName);
    static void Main(string[] args)
    {
        SetDllDirectory(@"Folder path");
        int err = Marshal.GetLastWin32Error();
        PrintJob printJob = new PrintJob("Printer name", @"Pdf file path", 1, 1);
        printJob.Print();
    }

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 2:59 PM.