0
我正在尝试使用HiQPdf将我的html代码转换为PDF。但我越来越低于错误。即使“HiQPdf.dep”和“HiQPdf.dll”是相同的位置。在MVC中使用HiQPdf转换为PDF时出现错误
在HiQPdf.dll中发生了“System.Exception”类型的异常,但未在用户代码中处理 附加信息:错误0xD8。检查HiQPdf.dep资源文件可以在HiQPdf.dll程序集附近找到,并且用户已经读取并执行此文件的权限。呼叫SetDepFilePath()方法,如果你放在HiQPdf.dep在不同的位置
下面是方法:
// 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;
对这个问题请帮助。
问候, 阿南德