使用Pdftron将Excel转换为C#格式的Pdf
我正在尝试使用Pdftron(Pdfnet)库将ASP.Net Web应用程序中的Excel文档转换为PDF。 以下是我的代码用于上述目的使用Pdftron将Excel转换为C#格式的Pdf,c#,pdf,pdftron,pdfnet,C#,Pdf,Pdftron,Pdfnet,我正在尝试使用Pdftron(Pdfnet)库将ASP.Net Web应用程序中的Excel文档转换为PDF。 以下是我的代码用于上述目的 pdf.PDF.PDFDoc newSalaryFitmentPdf = new pdf.PDF.PDFDoc(); pdftron.PDF.Convert.ToPdf(newSalaryFitmentPdf, newSalaryFitmentExcel.FullName); salaryFitment = newSalaryFitmentP
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
任何帮助都将不胜感激
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"
必须将应用程序设置为对这些目录具有读/写访问权限。有关更多信息,请参阅 似乎您没有权限,或者您应该在启用用户配置文件的情况下运行应用程序池,这将允许使用桌面文件夹。我在Word转换方面也遇到同样的问题。我已经做了你上面的建议,但我仍然得到以下错误。创建新Word应用程序实例时出错。代码:PDFTRON_未知(-2147024891)文件:“Word.cpp”:141日志:启动检查系统帐户。会话ID为:0。检查系统帐户。开始检查注册表。注册表检查完成。正在创建Word应用程序实例。条件表达式:false版本:6.8.0.64016N文件名:Convert.cpp函数:trn::PDF::Convert::topf行号:1721 InnerException:StackTrace:at pdftron.PDF.Convert.topf(PDFDoc in_PDFDoc,String in_Filename)at FileHelper.Program.ConvertToPdfFromFile(String filePathAndName)我正在进行转换的服务器是安装了MS Word 2013的Windows server 2016(未经许可)