Save current swf as a png?

Say for instance that you have a drawing app made in flash (not my case, but you get the picture) and want to make users able to save it to a png, is that doable? Is it possible to save it directly to some raster format or do I have to save coordinates or something and then parse it and paste the stuff with for example PHP/GD?