I found a peach of a tool today — it was exactly what I was looking for at exactly the right time.
We have a central database at my company, and the guys have been bugging me to work up some enhanced printing for it. They want to be able to print really top-quality reports — you know, the kind that don’t look like they were printed from a Web page so they can give them to clients.
I was fiddling around for a while trying to figure out the best way to do it. The obvious solution was to do server-side PDF creation, but all the tools I found left one thing or another to be desired (another post entirely). I thought about linking tables in Access and running reports there, but then we’d have to buy more Access licenses. I even tried instantiating Word client-side and printing to that, but it got to be a mess pretty quickly.
I finally started tackling the problem with CSS. If you use inches for your unit of measurement, set the overflow on your DIVs to “hidden,” and use “page-break-before” strategically, you can get some excellent results.
There is, however, one problem: the client’s browser printing setup. They probably have their print headers and footers set to something, their page margins are likely all screwy, and they may try to print to portrait when your report is designed for landscape. What to do?
Enter MeadCo’s ScriptX. This is an ActiveX control (yes, IE only) that makes IE print the way you want it to without the user hosing things up.
(With SP2 it prompts for installation, but in an intranet environment you can host the CAB file locally and massage security zones via the IEAK to make it transparent.)
For instance, a “Print Me” button on your page could (1) set the header and footer (or — more likely — clear them), (2) set the page margins to whatever value, (3) set the orientation to portait or landscape, and (4) print the currently loaded page to the default printer with no user involvement or prompt (they’d just see the little icon appear in the status bar and pages would start flying off the printer…). From the user’s standpoint, it’s like magic.
It gets better — you can have ScriptX print the contents of a FRAME or an IFRAME instead of the page it’s running in. So you could hide an IFRAME on the page with a printer-friendly version of the displayed content, then print that when the “Print Me” button is clicked. The user would get something totally different than what they were looking at (even far beyond the capabilities of CSS @media rules).
And all that was with the free version.
The advanced version allows you to set the printer, the page size, the collation values, the page range, the number of copies, etc. You can also query printers on the user’s system to find out their capabilities. You could very easily use this to print labels to a little Dymo mailing label printer, for instance.
And here’s the really cool part: the object can make an independent HTTP call and print the results. So you could have a user paging through a report, but when they press “Print Me,” the object goes back to the server to get the entire report and then prints that.
But wait, there’s more [cue cheesy informercial guy here] —
It can be used as a server-side COM object too, so it can print stuff based on data in your Web app. Here’s a hypothetical — your help desk Web app could accept a new ticket then print a work order to the laser printer sitting next to the computer geek in the department to which the ticket belongs. Or run a batch of reports in the middle of the night and print them to the printer in the CEO’s office so they’re waiting for him next to his coffee in the morning.
(Mind you, I haven’t bought the full version (haven’t had to — the free one does everything I need so far), so some of my ranting here is based on my reading of the docs. I could be off a little.)
Needless to say, I’m thrilled. I’m getting PDF-looking results from HTML and CSS, saving me dozens of hours of work. I predict I’ll upgrade to the full version before too long.
Prince: Overview: There's a big gap in getting Web content into print. I've had to cross the gap a couple times, and I've both generated PDFs server-side and used CSS to style HTML into printable format. Both methods suck. Prince is a system that lets you take XML, style it with…
My post about MeadCo ScriptX and browser-based printing got me thinking that browsers should allow print configuration on a per site basis. Think about it: you print different vastly things from different sites, and with the proliferation of Web apps, there are so many more times when you need to make…
You should have asked. We've been using ScriptX in PARC (think back...) for at least two years. Great tool. I'm suprised you didn't remember it.
Huh. I never really did anything with PARC. I was off in Tech Planning by then, just months away from being laid off.
You can try this one.
It´s a good tool. But you CAN'T SET THE ORIENTATION IN THE FREE VERSION!!! as you said.
The free version isn't a silver bullet for your application. The very good stuff is in the advance version (NOT FREE OBVIOUSLY) where you can change the page orientation and set the printer you want to print the HTML.
Regards.
you CAN'T SET THE ORIENTATION IN THE FREE VERSION!!!
Yes, you can. It's part of the 'free' subset, marked as 'basic' here:
Linked below is a method I found to force Landscape orientation in IE 6. Still trying to figure out a way to do it with IE 7 :-(
You can write a java applet in a half-hour that can do all the things Scriptx can do and it can run on every brower and every operating system. No licensing, no worries about user having active x disabled; Paying to use ScriptX is silly.
You can write a java applet in a half-hour [...] Paying to use ScriptX is silly.
Okay, write that and publish it then. Until then, kindly shut up.