<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Export DIV to JPG?</title>
	<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG/</link>
	<description>Comments on Ask MetaFilter post Export DIV to JPG?</description>
	<pubDate>Mon, 04 Feb 2008 00:45:38 -0800</pubDate>
	<lastBuildDate>Mon, 04 Feb 2008 00:45:38 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Export DIV to JPG?</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG</link>	
		<description>WebDev-2.0Filter: Using client side technologies (i.e. Javascript, ActiveX, Java... JS is preferred) is it possible to generate an image file (PNG or JPG, or even PDF) from a DIV tag on the page? &lt;br /&gt;&lt;br /&gt; I have a little web page where people can choose a bunch of options, click on, click off areas on a map etc... Is it possible, using only client-side technologies, to generate an image that represents the content in the DIV (A bunch of PNG images layered on top of each other and some text/controls)?&lt;br&gt;
&lt;br&gt;
Actually, all that is important to have in the image are a bunch of (alpha) PNG files layered on top of each other. Am I missing something simple here? Is there a magic JS library I can load? Am I not thinking about this little roadblock in the right way?&lt;br&gt;
&lt;br&gt;
The application is written for IE7 for now so anything that works in there is good. Extra points for browser agnostic or solutions across multiple platforms.&lt;br&gt;
&lt;br&gt;
MefiMail/Email me if you want more info... Thanks in advance!</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.82743</guid>
		<pubDate>Sun, 03 Feb 2008 23:48:21 -0800</pubDate>
		<dc:creator>puddpunk</dc:creator>
		
			<category>javascript</category>
		
			<category>webdev</category>
		
			<category>web</category>
		
			<category>image</category>
		
	</item> <item>
		<title>By: twiggy</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225675</link>	
		<description>&lt;a href=&quot;http://codinginparadise.org/weblog/2004/08/dynamically-generate-images-with.html&quot;&gt;The answer to your question on the technical feasibility is yes.&lt;/a&gt;  It&apos;s backed up &lt;a href=&quot;http://z.iwethey.org/forums/render/content/show?contentid=144936&quot;&gt;more than once...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
As for how to do it -- that&apos;s a more complicated story than an AskMe thread can cover, unless someone knows of a sweet library out there that&apos;ll do what you want.  Unfortunately I don&apos;t...</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225675</guid>
		<pubDate>Mon, 04 Feb 2008 00:45:38 -0800</pubDate>
		<dc:creator>twiggy</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225677</link>	
		<description>I&apos;m going to say a pretty confident &quot;no&quot; with generating an image of type PNG, JPG or PDF.&lt;br&gt;
&lt;br&gt;
You could definitely do an SVG client-side, because it&apos;s an XML-based format, but IE isn&apos;t going to display it.&lt;br&gt;
&lt;br&gt;
But if you really just need to show a number of images, at different X-Y positions and Z-indexes, that shouldn&apos;t be too difficult at all with CSS positioning.&lt;br&gt;
&lt;br&gt;
I think we need more detail, or a link.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225677</guid>
		<pubDate>Mon, 04 Feb 2008 00:47:15 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item><item>
		<title>By: puddpunk</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225680</link>	
		<description>Unfortunately both those links are a:followed for me, twiggy. When I looked at them I didn&apos;t find information enough to help me but I figured that the posts were over 4 years old and perhaps something had come along by then... Cheers mate.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225680</guid>
		<pubDate>Mon, 04 Feb 2008 00:49:27 -0800</pubDate>
		<dc:creator>puddpunk</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225682</link>	
		<description>Actually, I&apos;d forgotten about &lt;a href=&quot;http://www.designdetector.com/tips/domcsspencils.html&quot;&gt;this insane thing&lt;/a&gt;. If you&apos;re prepared to generate a 1x1 pixel DIV for each pixel, you can do anything you want.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225682</guid>
		<pubDate>Mon, 04 Feb 2008 00:51:44 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item><item>
		<title>By: twiggy</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225685</link>	
		<description>In rereading your post, I&apos;m wondering why having the bunch of images you want to display can&apos;t just be stored server-side, then placed into DIVs that are absolutely positioned over your main DIV, and set to display: none; visibility: hidden;&lt;br&gt;
&lt;br&gt;
Then, when checkboxes are checked - set display: block; visibility: visible;&lt;br&gt;
&lt;br&gt;
If you need to reposition them based on other settings, you can set the top: and left: parameters for that as AmbroseChapel says above.&lt;br&gt;
&lt;br&gt;
The z-index AmbroseChapel mentions, in case you&apos;re not familiar, is just the &quot;depth&quot; of layering...  &lt;br&gt;
&lt;br&gt;
Perhaps we&apos;re both not getting the whole picture of what you&apos;re trying to do, though.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225685</guid>
		<pubDate>Mon, 04 Feb 2008 00:56:00 -0800</pubDate>
		<dc:creator>twiggy</dc:creator>
	</item><item>
		<title>By: puddpunk</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225686</link>	
		<description>AmbroseChapel: It&apos;s a map and a bunch of check boxes. The checkboxes show/hide semi-transparent &quot;layers&quot; on top of the map. Both the map and the layers exist as PNG files with alpha channels.&lt;br&gt;
&lt;br&gt;
This is fine. It works and it&apos;s fast. I can hide/show layers with the tickboxes.&lt;br&gt;
&lt;br&gt;
The client has just asked for a way to export a file from it, with the selected layers, to give to clients and I&apos;m stuck... Just wondering if anyone had invented this particular wheel before.&lt;br&gt;
&lt;br&gt;
Note: this is a client side application hosted on their proprietary CMS - I can&apos;t run any server-side code on their servers.&lt;br&gt;
&lt;br&gt;
My current idea is to pop up another window with the selected layers on it only then invoke the browsers print function and get them to get a PDF printer or something. Not exactly ideal but I think it&apos;ll get the job done.&lt;br&gt;
&lt;br&gt;
Anybody got any ideas with ActiveX or Java?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225686</guid>
		<pubDate>Mon, 04 Feb 2008 01:00:10 -0800</pubDate>
		<dc:creator>puddpunk</dc:creator>
	</item><item>
		<title>By: seanyboy</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225692</link>	
		<description>&lt;i&gt;The client has just asked for a way to export a file from it, with the selected layers, to give to clients and I&apos;m stuck...&lt;/i&gt;&lt;br&gt;
Tell them to install a PDF Printer, or install Godwin Screen Printer on their PC (Set up to save screen grabs as PNG Files to the desktop)&lt;br&gt;
&lt;br&gt;
Low tech, but it&apos;ll work.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225692</guid>
		<pubDate>Mon, 04 Feb 2008 01:13:25 -0800</pubDate>
		<dc:creator>seanyboy</dc:creator>
	</item><item>
		<title>By: missmagenta</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225706</link>	
		<description>If its just a bunch of layered images you can layer them into a single image with php via gd or image magick.&lt;br&gt;
&lt;br&gt;
Just POST the checkboxes to a php script so it knows which layers to load and have it spit out a single graphic. &lt;br&gt;
&lt;br&gt;
Why does it have to be client-side? If you want it to &apos;appear&apos; client-side you could use ajax.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225706</guid>
		<pubDate>Mon, 04 Feb 2008 02:10:02 -0800</pubDate>
		<dc:creator>missmagenta</dc:creator>
	</item><item>
		<title>By: russm</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225707</link>	
		<description>take a look at &lt;a href=&quot;http://www.libpng.org/pub/png/pngaptk.html&quot;&gt;this page&lt;/a&gt; at libpng.org - it includes a bunch of Java/ActiveX (among others) tools that claim to read and write PNG graphics, as well as a pure JavaScript PNG writer (no read though)... it also looks like there may be &lt;a href=&quot;http://www.google.com/search?q=site:imagemagick.org+activex&quot;&gt;an ActiveX component for ImageMagick&lt;/a&gt;, which should do the job if it actually exists... so yeah, if your client wants to pay enough it looks like it shouldn&apos;t be impossible to put something together to do the job... but I suspect the reason there&apos;s no ready-made client side solution for this is most people reckon client side is the wrong place to do it...</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225707</guid>
		<pubDate>Mon, 04 Feb 2008 02:11:32 -0800</pubDate>
		<dc:creator>russm</dc:creator>
	</item><item>
		<title>By: roue</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225834</link>	
		<description>Windows has the PrintScreen button that will do screen capture to the clipboard. Just paste into Paint. OSX has &quot;grab&quot; built in.  Both of these are simple and you probably already have them.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225834</guid>
		<pubDate>Mon, 04 Feb 2008 07:36:54 -0800</pubDate>
		<dc:creator>roue</dc:creator>
	</item><item>
		<title>By: xthlc</title>
		<link>http://ask.metafilter.com/82743/Export-DIV-to-JPG#1225888</link>	
		<description>The only way to do it purely client-side with Java would be via signed applets, and that requires significant money and effort and results in a poor user experience. ActiveX might work, but then you&apos;re IE + windows only. &lt;br&gt;
&lt;br&gt;
It sounds like there might be some options for generating images on the client via JS (and definitely via a Java applet). Every CMS in the universe has some way of posting files as resources. So one option is to composite the images on the client and post the resulting bytes to the server via whatever the CMS file posting method is. Then the file will be available at some URL from the server, which you can then provide to the end user. &lt;br&gt;
&lt;br&gt;
IMO, you&apos;re better off taking the time and effort to negotiate the ability to develop and deploy a server-side plugin to their CMS. Otherwise anything you produce will be a brutal, fragile hack that will probably deliver a poor user experience.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.82743-1225888</guid>
		<pubDate>Mon, 04 Feb 2008 08:33:03 -0800</pubDate>
		<dc:creator>xthlc</dc:creator>
	</item>
	</channel>
</rss>
