I have recently completed prototyping a rather challenging problem that involves printing a document from a PeopleSoft page. The challenge is to find a way to print a separate document directly from the page. The functional SME somehow has an expectation that this functionality should behave like a native application — where by a click a button on the page, he will be presented by the Windows print dialog; the user can proceed and a document that is not the page being displayed will be printed on the user’s printer. Now, PIA applications are accessed via a web browser. Because of this, the features available to the application is limited by the web browser it is running on.

My first thought is this functionality would not be possible to implement without developing a plug-in. However after meditating on this for some time, an idea came over me on the possibility of using an iframe. Initial testing showed promise, so I proceeded with the solution.

The implementation did not went quite as smooth as I expected. There were a few other major challenges, and it was quite a learning experience. At one point I did get worried the final solution would become too complex to be manageable. Thank God the ultimate solution did turn out be simple enough and easy to implement on other pages.

There is one thing I developed on this project that I think will still be useful for me in the future. On some level, I’ve figured out a structured way for PeopleCode to assign a javascript to execute on a page. At first glance, this seems as simple as dropping an HTMLArea on the page, and populating it with javascript code, as described here. However, this will not work if you have some javascript that should only be executed once (for example, when user clicks a PeopleSoft button). You could assign the HTMLArea to derived field and populate the control on FieldChange. But the value of the derived field will not be cleared after the javascript code executes, and the javascript will keep executing on subsequent page refreshes. I will discuss more detail on this at a later article.