Print a page in the Portal

sreeshsurendran
Tera Guru

Hi all,

 

The requirement is to print the output diagnostic page of my portal, but I'm not getting the desired output. Please find below the HTML and Client Script and the sample output.

 

HTML Code:

<button ng-if='data.state == "completed"'class="btn-primary button3" class="button3"ng-click="printPart()">${Download results (PDF)}</button>

 

Client Script:

$scope.printPart = function() {
		var unprintableDiv = document.getElementById('uncontent');
		unprintableDiv.style.visibility = 'hidden';
		unprintableDiv.style.position = 'absolute';
		var printableDiv = document.getElementById('content');
		printableDiv.style.display = 'block';
		var additionalHideClasses = ['digico-footer-wrapper', 'bt-footer-curve'];
		additionalHideClasses.forEach(function(className) {
  	var elementsToHide = document.getElementsByClassName(className);
		for (var i = 0; i < elementsToHide.length; i++) {
				elementsToHide[i].style.display = 'none';
	}
		});

 

Output I'm getting through this code:

sreeshsurendran_0-1713330320633.png

 

My requirement is to remove the "Download full results" and the line above and Download results (PDF) button.

 

Any leads, please do let me know.

 

Best Regards,

Sreesh Surendran

 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@sreeshsurendran 

is that the complete client script?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

Hi @sreeshsurendran ,

If you want to remove the "Download full results" and the line above and Download results (PDF) button, can you please send me your HTML code may be there is <hr> tag may be there by which the line is coming and there is one more button may be called Download full results you can remove that code from HTML may be this will work. May be you can send me your HTML code I'll try to fix that 

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak