Browser-Based Printing with MeadCo ScriptX

By Deane Barker on January 3, 2005

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.

Gadgetopia
What Links Here

Comments

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. “You can write a java applet in a half-hour that can do all the things Scriptx can do”

    WOW … we’ve been developing ScriptX for over ten years, and now have a huge Winodws O(S/ IE test matrix to get

  6. Hi Deane

    Sorry for the scrappy post above.

    To the “waste of money” poster:

    If you can prove what you say and want a job, call me.

    Because what you can do is worth a great deal to my company.

    But if you can’t prove it, then you might want to rethink “silly”.

    “Actually, I’d pay for a cross browser solution.”

    We do offer a free plugin that may help you:

    http://www.meadroid.com/neptune/

    Jerry Mead | MeadCo’s ScriptX

  7. Hi am using MeadCo’s ScriptX for printing, while i am tring to print the model dialog box in ie 6 using javascript the application get hanging, please give a solution.

  8. @JerryMead Neptune is not a good replacement for cross browser support. It very clearly will not work on the Fruit that so many people are carrying around. The Company I work for has been licensed users of MeadCo for years, but here I am searching the web for a replacement of your product. Your product despite 10 years of testing and development is still buggy. For Example I have a client who has installed a new printer set it as default and uninstalled the old printer and yet ScriptX keeps trying to force print jobs to a nonexistent printer. I think it is time for you guys to embrace other browsers and OS’s or you are going to find it harder to sell.

  9. I am working on an application that has both browser and scriptx prints. When I first print a web page that is scriptx enabled, I am getting the print correct. Now when i make a print through browser, the print is retaining header and footer information from my previous print. I guess the values are saved in registry and not clearing out. I would be very thankful if some one could provide any information on this.

    Following is my working environment: Scriptx version – 6.5.439.72 IE version: 8 (issue happens in version 7 too) Windows XP

    Thanks, Raju.

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.