解决方案 »

  1.   

    http://wkhtmltopdf.org/
    wkhtmltopdf and wkhtmltoimage are open source (LGPL) command line tools to render HTML into PDF and various image formats using the QT Webkit rendering engine. These run entirely "headless" and do not require a display or display service.
      

  2.   

    HTML转图片?你是说像浏览器一样渲染页面然后保存为图片?
      

  3.   

    phantomjs,内置了浏览器内核,解析html转换成图片。
    还不错,demo我已经做出来了,基本问题都可以解决,自己google下,很简单。
      

  4.   

    css的样式比较负责,可以支持吗?
      

  5.   

    你这属于渲染dom和javascript,然后生成截图,楼上楼上说的phantomjs是一种,不过不太易用,可以用上层封装的casperjs,不过都是py写的,但也不耽误用。
      

  6.   

    用百度贴吧首页试了一下
    phantomjs 背景不正常
    wkhtmltoimage 中文乱码
    百度首页都正常。
      

  7.   

    javafx 可以通过 WebView的snapshot方法截图
      

  8.   

    不能使用javaFX的方式,phantomjs 可以支持复杂的css样式吗?
      

  9.   

    不能使用javaFX的方式,phantomjs 可以支持复杂的css样式吗?
    phantomjs 和wkhtmltoimage都是基于 webikit的, 对css的支持应该不错。