This content has been marked as final. Show 6 replies
> outputting the
> obtainted html within cfdocument tags to create a jpg of the page
This section is outside of CF abilities. Where are you outputting the
HTML? ColdFusion is not a browser, it won't render the HTML.
You would need some tool that renders the HTML and creates the JPG for
you. I do not know what this might be, but I am sure it is out there
it is in fact extremely easy to do in CF8. here's a working proof:
[warning: a dir "thumbnails" will be created if it does not exist OR
DELETED AND RE-CREATED IF IT DOES in the executed template's folder. the
it is the cfpdf's doings, not mine...]
getting url... <cfflush>
<cfhttp url=" http://www.sabai-dee.com" resolveurl="yes" result="myres">
... got it!<br>
creating in-memory pdf... <cfflush>
<cfdocument format="pdf" name="mypdf">
generating thumbnail... <cfflush>
<cfpdf action="thumbnail" source="mypdf" overwrite="yes">
here it is:<br><br>
<a href=" http://www.sabai-dee.com" target="sdc">compare to original</a>
there are numerous other settings one can employ in all the above-used
cf tags to control size, quality and other aspects of the generated
jpeg. and if you throw <cfimage> into the mix, the capabilities are
pretty much limitless...
Cool. Works OK for basic and simple HTMLs. However, when I try "www.yahoo.com", I get garbage. Flash, complex page structure, etc. Dont' forget to use useragent for IE or some other advanced browser, otherwise you will get plain HTML. I used:
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1)"
There is a real solution: http://www.cftagstore.com/tags/cfxwebthumb.cfm.
I agree with Mr Black. The weak link in the chain is cfdocument. It is not yet capable of reproducing an arbitrary website display as we see it in the browser.
just stumbled upon this:
the last entry, a web service, looks interesting....
haven't tried it yet, though...
Good find, Azadi.