I am not sure what is the proper term for the functionality that allows to print a document with no user interaction. In this post I am using "no-touch printing" term. For instance: Every morning Jon Smith turns on his computer at the office and runs his favorite internet browser. The browser opens the start page which is the company web-site. The start page of the company web-site indicates that Jon Smith has logged in and prints the daily schedule on the default printer that is set up on Jon's computer. Let's see how we can implement such scenario using ActiveReports6.
ActiveX Viewer And Flash Viewer.
ActiveX Viewer was introduced in the COM version of the product. ActiveReports was growing up, .NET framework became the product environment, but ActiveX Viewer never was dead in the water, and with good reason! ActiveX Viewer provides developer with the rich capabilities of displaying and printing the reports on the web. For example it's pretty easy to implement no-touch printing on the web with ActiveX Viewer. The code should load the report in the viewer, then wait until the loading is finished and then call PrintReport method. The knowledge base of ActiveReports has several articles that show the sample of such code.
Of course the main disadvantage of ActiveX Viewer is it's ActiveX component. ActiveX components officially operate only with IE and Windows. In our days the usage share of IE is only ~60%. Developers need more uniform technology that allows displaying and printing reports on the web. In ActiveReports6 ActiveX viewer is not supported but Flash Viewer is introduced instead.
Flash Viewer operates with any browser and any OS where the flash player is installed.
The bad news are Flash Viewer does not support no-touch printing.
So, it seems that there are no ways to implement no-touch printing on the web with ActiveReports6? Not exactly!
Turn around.
To display PDF documents in browser Adobe Acrobat Reader includes the Acrobat ActiveX control for Internet Explorer and the Adobe PDF Plug-In For Firefox and Netscape. ActiveX control or FF plug-in can be hosted by the HTML page and a PDF document can be loaded and printed using Javascript or Visual Basic code of that page. I am confident that no-touch printing is possible to implement with Acrobat ActiveX control and I believe that it's possible with Adobe FF plug-in as well. In other hand ActiveReports6 includes the RPX handler which can return the report is saved in PDF format...No more words! Here is sample of code which performs no-touch printing of the report using Acrobat ActiveX control:
<html>
<body onload="window.setTimeout('em.PrintAll();', 5000);">
<div id="PdfContainer">
<span style="font-size: large;">Please wait for a few seconds and the printing will be starting.</span>
<embed id="em" width="0" height="0" src="HelloWorld.rpx?OutputFormat=PDF" />
</div>
</body>
</html>
The code uses EMBED tag to host the PDF document which is returned by RPX handler. PrintAll method prints the entire document without displaying a user dialog box. There are two issues with that code. First of all, it uses the timeout approach to wait until the document is loaded in PDF viewer. I think it's possible to intercept the event which is raised by PDF control when the document loading is completed, I just don't know the exact way to do that. The second issue is the warning which appears before printing starts:
Once "Don't show this message again" checkbox is unchecked, the code provides the no-touch printing, really.
Great Silver Hope
Eventually we will add the Silverlight-based Reports Viewer for ActiveReports. At the moment the most recent version of Silverlight is v.4 Beta 2 and it's new features list includes:
Comprehensive printing support enabling hardcopy reports and documents as well as a virtual print view, independent of screen content.
Unfortunately, that "comprehensive printing support" does not include no-touch printing. The great review of Silverligh 4 printing is available here.
Perhaps the final version of Silverlight 4 or 5 will support no-touch printing. Then we will add the Silverlight-based Reports Viewer and no-touch printing will be fully supported in ActiveReports. That's what I called "Great Silver Hope":)
Technically no-touch printing is considered a security vulnerability. If you think about it, it makes sense too. Imagine visiting a website and your printer starts printing stuff randomly without you doing anything! So it seems reasonable that at least someone should have to accept a print dialog before printing commences.
ReplyDeleteScott, I agree with you!
ReplyDeleteHowever, our customers often ask about no-touch printing capabilities.
I.e. see http://www.datadynamics.com/forums/130473/ShowPost.aspx
And Lord knows how they want to use this feature...the channel for chain letters?:)