我想在(呈现ng-view)之后将我当前的HTML页面导出为pdf。我正在使用 EvoPDF 软件来执行此操作,但是当我尝试将其导出时,ng-view 中的 HTML 并没有像它一样出现在 pdf 中。PDF 仅包含标题,因为标题是静态元素,并且 ng-view 是从 XmlHttpRequest 构造的。
我试着给 pdfConverter.ConversionDelay = 10; 认为由于 XmlhttpRequest 的加载时间它没有呈现但仍然没有运气。
我在 .net 中使用 HttpModule 作为后端。
public void ProcessRequest(HttpContext context)
{
if (context.Request.UrlReferrer != null)
{
try
{
HtmlToPdfConverter pdfConverter = new HtmlToPdfConverter();
pdfConverter.ConversionDelay = 10;
byte[] outPdfBuffer = pdfConverter.ConvertUrl(context.Request.UrlReferrer.ToString());
context.Response.AddHeader("Content-Type", "application/pdf");
// Instruct the browser to open the PDF file as an attachment or inline
context.Response.AddHeader("Content-Disposition", String.Format("{0}; filename=report.pdf; size={1}",
"attachment", outPdfBuffer.Length.ToString()));
context.Response.BinaryWrite(outPdfBuffer);
// End the HTTP response and stop the current page processing
context.Response.End();
}
}
}
你能告诉我如何解决这个问题吗?
谢谢。萨杰什·南比亚尔