Recently I had a client requirement that involved printing of CRM pages that contained web resources. The standard print functionality in Dynamics CRM only supports printing static content, so some web resources used on the page being printed was omitted. The user wanted to use the browsers print capabilities and it all worked great, except that the Dynamics CRM header was included on the top.

Print preview showing CRM menu

As you can see from the picture above, the menu from CRM on the top of the page, taking up some much needed space from other content.

The solution in our case was to do a little unsupported change by injecting some CSS in the page with JavaScript. You will only see this change when printing because of the media in the CSS is set to print.

$('head').append('<style>@media print { #crmMasthead, #crmTopBar {display: none !important;} #crmContentPanel {top: 0 !important;}}</style>');

As you can see below, the menu is now gone and we get some extra space on each page when printing.

Print preview showing page without CRM menu

blog comments powered by Disqus

About Sebastian

Sebastian Holager

Sebastian Holager is a developer working at a CRM Norge in Oslo, Norway. At day time hacking away on Dynamcs CRM, C# and JavaScript. While at night playing around with other programming languages, reading and watching football.

Follow me on twitter