現在の HTML ページ (ng-view がレンダリングされた後) を pdf にエクスポートしたいと考えています。私はそれを行うために EvoPDF ソフトウェアを使用していますが、それをエクスポートしようとすると、ng-view 内の HTML がそのまま pdf に取り込まれません。ヘッダーは静的要素であり、ng-view は XmlHttpRequest から構築されているため、PDF にはヘッダーのみが含まれます。
私は 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();
}
}
}
これを修正する方法を教えてください。
ありがとう。サジェシュ・ナンビア