直接将 .aspx 转换为 .pdf [英] Directly convert .aspx to .pdf

查看:43
本文介绍了直接将 .aspx 转换为 .pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理的一个项目要求我构建一个以 HTML (.aspx) 和 PDF 格式输出的报告.是否有可用的解决方案允许我将 .aspx 页面的输出提供给 PDF 生成实用程序?完全支持 HTML 和 CSS 将是理想的选择.

A project I am working on requires me to build a report that is output in both HTML (.aspx) and as a PDF. Is there a solution available that allows me to feed the output of an .aspx page to a PDF generation utility? Full support of HTML and CSS would be ideal.

谢谢!

推荐答案

wkhtmltopdf 会做....用法:

wkhtmltopdf http://www.google.com google.pdf

就是这样.您可以访问任何网页...甚至是 aspx.css 比任何其他实用程序都得到更好的支持,因为它使用 webkit html 渲染引擎(Safari、Chrome).享受

That is it. You can go to any web page... even aspx. css is supported better than any other utility as it uses the webkit html rendering engine (Safari, Chrome). Enjoy

有一个 .exe (7 mb) 可以通过使用 Process.Start 从 .Net 中使用确保将 exe 复制到项目目录中,否则必须指定完整路径.例如:

There is a single .exe (7 mb) that can be used from .Net simply by using Process.Start Make sure that you copy the exe into your project directory or you have to specify the full path. ex:

static void HtmlToPdf(string website,string destinationFile)
    {
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.FileName = "wkhtmltopdf.exe";
        startInfo.Arguments = website+" "+destinationFile;
        Process.Start(startInfo);
    }  

我认为支持 SSL,但我认为目前无法使用 2 向 SSL.这是我见过的最好的单站 HTML -> PDF 工具.

I think SSL is supported but I do not think that 2-way SSL would work at the moment. It is hands down the best single stop HTML -> PDF tool I have seen.

这篇关于直接将 .aspx 转换为 .pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆