Posted: 5 Dec 2017 14:55 EST Last activity: 15 Dec 2017 5:06 EST
How do you print preview the current screen without altering PrintView Harness?
Hello Pega Community,
We have a requirement to print preview the screen that the user is currently viewing using a button/link. This button/link will be visible within a case in our footer of the case. The cases we want to print out of have multiple stages and within each stage, there can be multiple processes. It should grab the header, stage information, case information, and footer of each case. I was attempting to alter the PrintView harness, but I ran into errors where it would not grab the current tab that I was viewing, it would always grab the first tab. For example, if I was within the CaptureDetails stage which has Details and Approvers processes within it, if I am viewing the Approvers tab, it will still print preview the Details tab as that is first in our CaseActionArea.
Was wondering if there was an implementation to be able to print the full case information that the user is currently viewing. If there is a way to configure the PrintView harness to show exactly what the user is seeing, that would be great. If there is another way to print preview the current screen (ideally whatever the user is viewing on their webpage like how a web browser's print preview works) I would love to try to implement that as well.
Thanks Rachit! That helped a lot. It is printing whatever is on the screen, but not the full page. I am testing this in Chrome and it will only pull up 1 page on the print preview even though at times there should be multiple pages based on the amount of data on the screen I am viewing (cuts off some necessary data). Can I configure the testfunction you showed somehow to get it to print preview the full page rather than just one solitary page?
Posted: 3 years ago
Posted: 6 Dec 2017 11:10 EST
Rachit Agarwal (Rachit_Agarwal)
Senior Technical Solutions Engineer
Can you please share some screenshots as to what data do you want to print because window.print() will only print the data that is present currently on the page. It will help me in understanding what you mean by full/multiple pages.
Just need to ensure that 'div1' is replaced by the correct div that you want to print out (should be something related to HARNESS to print out the full harness you want) and after this script is called, refresh the harness to be able to have active tabs. Without refreshing the harness, it remains stuck on the current tabs that the user is viewing.