[英]Can I print html files (with images, css) from the command-line?
我想用脚本中的图像打印样式化的 html 页面。 谁能建议一个开源解决方案?
我正在使用 linux (Ubuntu 8.04),但也对其他操作系统的解决方案感兴趣。
你可以试试html2ps ,它是用 Perl 编写的,所以我猜它可以在任何运行 Perl 的操作系统上运行。 它确实支持 CSS 和图像。 它没有您可能想要的那么好。
要在 Debian/Ubuntu 中使用sudo aptitude install html2ps
,然后将输出通过管道传输到lpr
进行打印:
html2ps \
http://stackoverflow.com/questions/286583 \
|lpr
或者将输出通过管道传输到 ps2pdf 以转换为 pdf 文件:
html2ps \
http://stackoverflow.com/questions/286583 \
|ps2pdf - stackoverflow.pdf
如果您的安装上有 kde,那么您可以启动 konqueror 并使用 dcop 或 dbus 向其发送命令。 这意味着你必须让 x 运行,这可能对你不起作用。
我不确定这段代码是否适用于单声道,但它至少应该适用于 Windows 和“真正的”.NET Framework: http : //pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail -Screenshot-Image.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.