Unable to load DLL 'PDFNetC' or one of its dependencies: The specified module could not be found

Dear Team,

I am using PDFTron in .net core web application. I am getting an error at PDFNet.Initialize();
The error message is "Unable to load DLL ‘PDFNetC’ or one of its dependencies: The specified module could not be found."

I have installed the dll from Nuget Manager bu using PDFTron.NETCore.Windows.x64.

below is my code.

public IActionResult SplitFilesByPage(string sInFileName, string sSplitFolderName)
{
List lReturn = new List();
try
{
string sSplitFoldersPath = _iconfiguration.GetSection(“fileLocations”).GetSection(“SplitFoldersPath”).Value;
string sScannedPDFPath = _iconfiguration.GetSection(“fileLocations”).GetSection(“ScannedFilesPath”).Value;
string sSplitFoldersWorkFolder = _iconfiguration.GetSection(“fileLocations”).GetSection(“SplitFoldersWorkFolder”).Value;
sInFileName = sInFileName.Trim();
sSplitFolderName = sSplitFolderName.Trim();

cPDF oPDF = new cPDF();

List lFiles = oPDF.SplitPDFByPage(sScannedPDFPath + sInFileName, sSplitFoldersPath, sSplitFolderName, true);

int iPage = 0;
foreach (var sFile in lFiles)
{
iPage++;
cSplitFilesReturn oFile = new cSplitFilesReturn();
oFile.FileName = sSplitFoldersWorkFolder + “/” + sSplitFolderName + “/” + sFile;
oFile.PageNo = iPage;
lReturn.Add(oFile);
}

return this.Ok(lReturn);
}
catch (Exception EX)
{
}
}

public class cPDF
{
public static PDFNetLoader Loader { get; private set; }

static cPDF()
{
Loader = PDFNetLoader.Instance();
PDFNet.Initialize();
}

public List SplitPDFByPage(string sPDFPath, string sOutputPath, string sSplitFolder, bool bDeleteFilesBeforeSplit = true)
{
}

}

Typically “The specified module could not be found.” means exactly that, that PDFNetC is not in any accessible, searched, location.

You may want to review this.
https://www.pdftron.com/documentation/windows/get-started/dotnet-core/#initial-setup

It is possible that you are getting this error because your process is 32bit, though that typically manifests as a “format” errorr.

Are you able to download our standalone SDK package, and run the .NET Core samples?
https://www.pdftron.com/downloads/PDFNetC64.zip
Just unzip, and go to one of the samples folders, into the “CS” folder, and execute “dotnet run”.
https://www.pdftron.com/documentation/dotnetcore/get-started/integration/windows#run-the-samples

Hi, I am getting the same issue " Unable to load DLL ‘PDFNetC’ or one of its dependencies" when running pdftron sample in windows docker container. Could you please let me know, where should I add the “PDFNetC.dll” in container to make this work.

1 Like

@rtripathi - I realize that your post is from 2022, but did you ever find a solution to this?

Thanks!
-Brian