Sunday, May 15, 2005

Why I Love CF...

Those who know me, and what I do have no doubt heard me go on and on, and on, about the things that I love about ColdFusion. Well I just found another thing to totally love.
<link rel="stylesheet" type="text/css" href="css/main.css" title="Main Style Sheet" media="screen">

<link rel="stylesheet" type="text/css" href="cssprint.css" title="Print Style Sheet" media="print">

Most web coders know the differences between the two lines above. The second is supposed to make it possible for the browser to have different print styles. This doesn't really work, because all browsers suck as a printable platform. CF 7 introduced a new tag, <CFDocument> allowing direct output to PDF or FlashPaper. What I didn't know, and I'm not sure is in the docs is that when it renders, it will pull the print style sheet. What does this mean? It means that you don't have to have a separate index page for your printable reports. For example, the project that I am working on right now has a calendar with events; because of this new feature, I have added a "print" link to every page that opens a new window with the current page inside a <CFDocument> formatted for FlashPaper or PDF.

Thus allowing a completely controllable print version and thanks to CF7 and use of multi stylesheets I only have to change one file to tweak the print output.


Scott said...

Dem ... still creating reports in HTML??? You should be using CFReport ;)

Demian said...

Ha HA!

I would use CFReport, however, the project doesn't require its power... smart ass! ;)