2

我正在尝试使用 Pdftron (Pdfnet) 库在 ASP.Net Web 应用程序中将 Excel 文档转换为 PDF。以下是我用于上述目的的代码。

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

但是当程序尝试执行第二行时,我得到了以下异常。

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

任何帮助将不胜感激。

4

1 回答 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"

您必须将应用程序设置为对这些目录具有读/写访问权限。请参阅这篇文章了解更多信息。

于 2017-09-01T00:28:02.970 回答