Exporting Cappuccino views to HTML

On the way to implementing PDF export, I needed to be able to transform Mockingbird pages into static HTML.  So, I added a simple category to CPView.  This category creates a cloned DOMElement of the CPView's DOMElement that has the canvas elements converted to PNG images.  I then use XMLSerializer to serialize and send this data to my server.  You can get the gist of it here - http://gist.github.com/253272 .

This uses Nihilogic's Canvas2Image library, which requires base64.j .  The one problem with this code is it won't work in IE since it requires a canvas-enabled browser.

In the meantime, hope this can help someone else trying to do something similar =).

Loading mentions Retweet
Posted 3 months ago

1 comment

Feb 17, 2010
Scott said...
Man you are such a good programmer

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    twitter