turn a web page into an image with ColdFusion, Java or command line utility?

試著忘記壹切 提交于 2019-12-23 17:36:59

问题


Native ancient solution in ColdFusion that used to work with HTML 3.x...

<cfhttp url="#targetUrl#" resolveurl="yes"> 

<cfdocument format="pdf" name="pdfVar">
    #cfhttp.filecontent# 
</cfdocument> 

<cfpdf action="thumbnail" source="#pdfVar#" pages="1" destination="image">
<cfimage action="writeToBrowser" source="#image#">

Super slow, even with cache, many CSS styles missing or broken.

Any good server-side solution to capture a rendered webpage into a thumbnail? like service provided by http://www.shrinktheweb.com/ ?

Any ColdFusion, Java or Command line utility solution?


回答1:


This website has a script that does what I think your looking for, I haven’t tried using it for any server-side project though.

http://khtml2png.sourceforge.net/

Doesn’t make thumbnails though, but you could render the image created with cfimage.




回答2:


If you have ColdFusion version 8 or better, you can simply use CFDOCUMENT to create a thumbnail.

From Ray's post:

<cfdocument src="http://www.coldfusionjedi.com" name="pdfdata" format="pdf" />
<cfpdf source="pdfdata" pages="1" action="thumbnail" destination="." format="jpg" overwrite="true" resolution="high" scale="25">



回答3:


We ended up using SiteShoter which uses IE as the renderering engine. http://www.nirsoft.net/utils/web_site_screenshot.html



来源:https://stackoverflow.com/questions/7341782/turn-a-web-page-into-an-image-with-coldfusion-java-or-command-line-utility

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!