Can we add Print button to document viewer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 11:15 PM - edited ‎12-16-2024 11:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 11:26 PM
you will have to customize the OOB ui page or widget.
Please discuss this with your customer.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2024 03:46 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2024 11:26 PM
Hi @Shivani5
To add a print button to a document viewer in ServiceNow instead of a download option, you can follow these general steps. The exact implementation may vary based on your specific ServiceNow instance and the way your document viewer is set up. Here’s a basic outline of how you can achieve this:
Steps to Add a Print Button in ServiceNow Document Viewer
-
Identify the Document Viewer: Determine where the document viewer is located in your ServiceNow instance. This could be a UI page, a widget, or a specific form.
-
Modify the UI Page or Widget:
- If you are using a UI page, navigate to System UI > UI Pages and find the relevant page.
- If you are using a widget, go to Service Portal > Widgets and locate the widget that contains the document viewer.
-
Add a Print Button:
- In the HTML section of the UI page or widget, add a button element for printing. For example:
- <button id="printButton" onclick="printDocument()">Print Document</button>
-
Implement the Print Functionality:
- You will need to create a JavaScript function that handles the print action. This function can be added in the script section of the UI page or widget. Here’s a simple example:
- function printDocument() {
// Assuming the document viewer is in an iframe or a specific div
var printContent = document.getElementById('documentViewerId'); // Replace with your document viewer's ID
var WinPrint = window.open('', '', 'width=900,height=650');
WinPrint.document.write('<html><head><title>Print Document</title>');
WinPrint.document.write('</head><body >');
WinPrint.document.write(printContent.innerHTML); // Get the content to print
WinPrint.document.write('</body></html>');
WinPrint.document.close();
WinPrint.print();
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/