0

現在の 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();

            }

        }
    }

これを修正する方法を教えてください。

ありがとう。サジェシュ・ナンビア

4

1 に答える 1

1

問題はありませんでした。ローカル システムで CORS の問題が発生したため、データを取得するための呼び出しが失敗しました。現在、すべてが機能しています。

よろしく、サジェシュ

于 2014-11-10T12:45:40.733 に答える