2

I am trying to convert an Excel document into PDF in a ASP.Net Web application using Pdftron (Pdfnet) library. Following is my code for the above purpose.

    pdf.PDF.PDFDoc newSalaryFitmentPdf = new pdf.PDF.PDFDoc();
    pdftron.PDF.Convert.ToPdf(newSalaryFitmentPdf, newSalaryFitmentExcel.FullName);
salaryFitment = newSalaryFitmentPdf.Save(pdf.SDF.SDFDoc.SaveOptions.e_linearized);

But I am getting the following exception when the program is trying to execute the second line.

Exception: 
     Message: An error occurred while converting the file.
Detailed error:
    Error creating a new Excel application instance.
Code: PDFTRON_UNKNOWN (-2147024891)
      File: "Excel.cpp":51
    Log:
      Start check system account.
      Session ID is: 0.
      Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\system32\config\systemprofile\Desktop"
      Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\SysWOW64\config\systemprofile\Desktop"
      Done checking system account.
      Creating an Excel application instance.

     Conditional expression: false
     Version    : 6.7.1.61823N
     Filename   : Convert.cpp
     Function   : trn::PDF::Convert::ToPdf
     Linenumber : 1692

Any help would be highly appreciated.

Amit Anand
  • 957
  • 1
  • 16
  • 25
  • 2
    Seems you either do not have rights or you should run the app pool with user profile enabled which will allow for the use of a desktop folder. – Igor Aug 31 '17 at 15:32

1 Answers1

2
Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\system32\config\systemprofile\Desktop"
Failed to create Desktop folder in SystemProfile. boost::filesystem::create_directory: Access is denied: "C:\Windows\SysWOW64\config\systemprofile\Desktop"

You must set your application to have read/write access to these directories. Please see this article for further information.

  • I'm having the same issue with Word conversion. I have done what you advice above but I still get the following error. Error creating a new Word application instance. Code: PDFTRON_UNKNOWN (-2147024891) File: "Word.cpp":141 Log: Start check system account. Session ID is: 0. Done checking system account. Start checking registry. Registry check done. Creating a Word application instance. – SurenSaluka Mar 22 '18 at 12:22
  • Conditional expression: false Version : 6.8.0.64016N Filename : Convert.cpp Function : trn::PDF::Convert::ToPdf Linenumber : 1721 InnerException: StackTrace: at pdftron.PDF.Convert.ToPdf(PDFDoc in_pdfdoc, String in_filename) at FileHelper.Program.ConvertToPdfFromFile(String filePathAndName) The server I'm doing the conversion is Windows Server 2016 with MS Word 2013 installed (Unlicenced) – SurenSaluka Mar 22 '18 at 12:23