【发布时间】:2016-08-23 14:33:33
【问题描述】:
我正在使用 nReco HtmlToPdfConverter 类尝试将 html 文档转换为 pdf。除了一个例外,这可以正常工作。我有在 document.ready 上运行的 javascript,并且在将 html 转换为 pdf 时未呈现 javascript,导致我的条形码(由我的 javascript 生成)未在 PDF 中呈现。我正在寻找一种方法来延迟转换,直到文档准备好并且尚未找到执行此操作的方法。目前我正在使用以下内容来转换我的 html 文档:
var converter = new HtmlToPdfConverter {PageFooterHtml = "<div>Page: <span class='page'></span><div>", Margins = new PageMargins() {
Bottom = 10,
}, CustomWkHtmlArgs = "--print-media-type"
};
var pdfBytes = converter.GeneratePdfFromFile(url, null);
我的 html 页面上未在 pdf 中呈现的 javascript 看起来像:
<script>
$(document).ready(function () {
..javascript which changes my html
});
</script>
【问题讨论】:
标签: javascript c# html pdf