我可以从命令行打印html文件(带有图像,css)吗? [英] Can I print html files (with images, css) from the command-line?
问题描述
我想使用来自脚本的图片打印样式化的html页面。任何人都可以建议开源解决方案?
I want to print styled html pages with their images from a script. Can anyone suggest an open-source solution?
我使用的是linux(Ubuntu 8.04),但也会对其他操作系统的解决方案感兴趣。
I'm using linux (Ubuntu 8.04) but would be also be interested in solutions for other operating systems.
推荐答案
您可以给予 html2ps 尝试,它是用Perl编写的,所以我想它可以运行在任何操作系统上运行Perl。它支持CSS和图像。
You could give html2ps a try, it is written in Perl, so I guess it wil run on any operating system that runs Perl. It does support CSS and images. It does not render as good as you may perhaps want.
在Debian / Ubuntu中使用 sudo aptitude install html2ps
然后将输出传递到 lpr
以打印:
To use in Debian/Ubuntu sudo aptitude install html2ps
and then pipe the output to lpr
to print:
html2ps \
http://stackoverflow.com/questions/286583 \
|lpr
或将输出转换为ps2pdf以转换为pdf文件:
Or pipe the output to ps2pdf to convert to a pdf file:
html2ps \
http://stackoverflow.com/questions/286583 \
|ps2pdf - stackoverflow.pdf
这篇关于我可以从命令行打印html文件(带有图像,css)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!