简体   繁体   中英

File doesn't exist exception - Spire PDF for .NET

I am using the following code to attempt to print a PDF file using Spire PDF.

Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();

doc.LoadFromFile(monroneyFilename);

doc.PrinterName = monroneyPrinter;
lock (printLock)
{
    doc.PrintDocument.Print();
}

When it gets to the LoadFromFile method, it gives me a File doesn't exist exception. The rest of the code doesn't execute.

The monroneyFilename is "p:\\foldername\\11111111111111111.pdf" where the ones are 17 characters representing a Vehicle Identification Number.

There are no spaces in the filename or folder name, so the other answers I've seen about this do not apply.

I'm running this from within an ASP.NET Web Service.

Anyone have any ideas?

I was able to discover the problem. The P: drive was mapped to a folder on a network PC on a VPN on the server. I was crossing domains, so the user for the AppPool of the web service was not able to access the files on the remote server. I was able to copy the PDF locally and access it that way to test and it worked fine.

It seems Spire does not give exceptions for bad credentials, it just tells you the file doesn't exist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM