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.

1
  • 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. Commented Aug 31, 2017 at 15:32

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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.
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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.