我试图使用HiQPdf将我的html代码转换为PDF。但我的错误越来越少了。尽管"HiQPdf.dep“和"HiQPdf.dll”是相同的位置。
类型为“System.Exception”的异常发生在HiQPdf.dll中,但未在用户代码中处理附加信息:错误0xD8。检查HiQPdf.dep资源文件可以在HiQPdf.dll程序集附近找到,并且用户对该文件具有读取和执行权限。如果将SetDepFilePath()方法放在不同位置的中,则调用()方法
以下是方法:
// get the HTML code of this view
string htmlToConvert = RenderViewAsString("GetHTMLView", null);
// the base URL to resolve relative images and css
String thisPageUrl = this.ControllerContext.HttpContext.Request.Url.AbsoluteUri;
String baseUrl = thisPageUrl.Substring(0, thisPageUrl.Length - "tblWSRDetails/ConvertWSRReportToPdf".Length);
// instantiate the HiQPdf HTML to PDF converter
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
// hide the button in the created PDF
htmlToPdfConverter.HiddenHtmlElements = new string[] { "#ConvertReportToPdf" };
// render the HTML code as PDF in memory
byte[] pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory(htmlToConvert, baseUrl);
// send the PDF file to browser
FileResult fileResult = new FileContentResult(pdfBuffer, "application/pdf");
fileResult.FileDownloadName = "WSR.pdf";
return fileResult;请在这个问题上提供帮助。
你好,阿南德
发布于 2019-05-27 11:55:11
我解决了这个错误,在我的主机提供程序中授予App_Data、Bin和Content (其中我保存pdf文件)文件夹的写权限。
发布于 2016-02-16 09:34:51
引发此错误是因为您试图将该库用于32位计算机上的64位环境。您必须使用与32位和64位计算机兼容的库的正常版本,或者更好的是,您可以在64位计算机上运行转换器。
https://stackoverflow.com/questions/34635841
复制相似问题