Saturday, July 10, 2010

5 minutes with Safari 5

I just upgraded to Safari 5 about 5 minutes ago... and already feel compelled to blog about it!

Right off the bat, it was noticeably faster loading pages and running scripts! No benchmark tests necessary. Its just noticeably faster.

Secondly, Safari Reader, the new streamlined article reader extension is absolutely beautiful! When Safari recognizes an article embedded in a web page, it enables a "Reader" button in the url. Clicking on the Reader button launches a pdf like reader above the web page, with all the clutter removed, and provides simple scrolling through the entire article. You have to see it to appreciate it. Very nice.

My first question, is how does this work? Is Safari Reader looking for special markup? New HTML 5 article tags perhaps? Nope. It appears it uses an algorithm to score content as being article like; number of child block elements inside a parent element other then body (like div p p p p), with article like content containing comas and particular text patterns, etc.

I'm also looking forward to checking out the super HTML 5 support, and Safari Extensions.

More to read about it all here:

A very fun first 5 minutes!

Tuesday, July 6, 2010

pdfkit for html to pdf

I can't tell you how many times I've needed a quick simple html to pdf solution, and instead end up using something a little more complex then the simple requirement deserves. When it comes to building pdf with Rails based solutions, I'm a fan of Prawn. And, I still highly recommend Prawn for serious PDF projects; things like templating and filling in legal forms, where field layout precision and typeset and the driving factors.

But for those times that I already have an html page/form and just want to convert it from html to pdf for download or email has always been either a) too expensive, or b) too complex.

Why can't I use HTML+CSS? Why can't I use a print css media link to drive my HTML to PDF conversion? Why can't it be as seamless as adding some middleware?

Well, now thanks to an open source effort by the folks at Relavance, it looks like we can with: PDFKit

You can read more about it on their blog post.

I can think of so many times this sounds like exactly what the doctor ordered!

I'm not attempting to compare PDFKit and Prawn, because it doesn't look like PDFKis attempting to scratch the same itch that I've come to love Prawn for. But, it does look like PDFKit could potentially be exactly what I've looked for many times over. I'll post more about it once I have another quick HTML to PDF need.