The CreatorCon Call for Content is officially open! Get started here.

Printing Knowledge Articles (kb_article) in Service Portal

Kostya
Tera Guru

To whom it may concern: when you printing your KB articles in Service Portal you'll face the problem, that only first page is shown in print preview and is printed. Our customers are using the browser printing capability (Ctrl+P).

Capture1.PNG

Caption: Only first page is printed, all following pages are simply skipped

A problem for this issue was logged by ServiceNow support (PRB738544) but there is workaround pretty simple as for now. Because the root cause is the CSS style definition of the section "page" on kb_article page, you can use the "Page Specific CSS" to redefine the styles.

After view tries, I figured out, that following works great:

Capture.PNG

Caption: Define your specific css for a page

I used "media print" to only modify the style for printing, because I do not want any unwanted side effects for my users just reading the article on screen. But even without "media print" the portal looks same like before.

This should be a workaround, because I think its not the best option to define page specific CSS. After some years you may have unmanageable portal anymore.

So, my question to you, guys: maybe you already faced similar challenges? How do you fix this kind of problems? Do you define global CSS? Are you overwrite the default one?

Hit the Thumb Icon and/or mark as Correct, if my answer was correct. So you help others to see correct responses and I get fame 🙂

Cheers,
Kostya
1 REPLY 1

tstocking
Tera Guru

We have the same requirement and I tried your workaround but was unsuccessful. I am on Istanbul Patch 1. I wasn't able to view that problem record either. I ended up creating a different work around. I coped the kb_view UI Page and added a client script at the bottom:



window.onload = function() {


  window.print();


};



Then from the portal, we have a "Printer" icon on each article and I just build the link in the client script code of the article page widget:



For example:



$scope.data.printView = 'https://' + $scope.data.instance + '.service-now.com/kb_view_trs.do?sysparm_article=' + $scope.data.number + '&sysparm_stack=no&sysparm_force_row_count=999999999&sysparm_media=print';



Then just create an href link using this in your HTML template



<a href="{{ ::data.articleLink }} " class="no-print"><glyph sn-char="envelope" class="no-print pad-right no-print"/></a>