使用Pdftron在C#中Excel到Pdf

时间:2017-08-31 15:29:38

标签: c# pdf pdftron pdfnet

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

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>testdomain.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
            <false/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <true/>
            <key>NSThirdPartyExceptionMinimumTLSVersion</key>
            <string>TLSv1.2</string>
            <key>NSRequiresCertificateTransparency</key>
            <false/>
        </dict>
    </dict>
</dict>

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

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

任何帮助都将受到高度赞赏。

1 个答案:

答案 0 :(得分: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"

您必须将应用程序设置为对这些目录具有读/写访问权限。有关详细信息,请参阅this article