<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SharePoint Global Services Blog &#187; SharePoint</title>
	<atom:link href="http://blog.sharepointglobalservices.com/tag/sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sharepointglobalservices.com</link>
	<description>Providing consulting services one customer at a time</description>
	<lastBuildDate>Fri, 01 Oct 2010 13:29:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Printer-Friendly CSS and Print Preview in MOSS 2007</title>
		<link>http://blog.sharepointglobalservices.com/2010/02/07/printer-friendly-css-and-print-preview-in-moss-2007/</link>
		<comments>http://blog.sharepointglobalservices.com/2010/02/07/printer-friendly-css-and-print-preview-in-moss-2007/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 14:09:37 +0000</pubDate>
		<dc:creator>Gilles Urena</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Printer-Friendly]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://blog.sharepointglobalservices.com/?p=88</guid>
		<description><![CDATA[This post was driven by a request I recently received to add a Print Preview button on a SharePoint page.  When clicked, the Print Preview button will popup a window without any SharePoint navigational elements.   I decided to create a separate CSS file (called PrintPreview.css) to overwrite the following MOSS CSS classes: /* Hide MOSS Globa Links, title, banner and Top Nav area [...]]]></description>
			<content:encoded><![CDATA[<p>This post was driven by a request I recently received to add a <strong>Print Preview</strong> button on a SharePoint page.  When clicked, the <strong>Print Preview</strong> button will popup a window without any SharePoint navigational elements.  </p>
<p>I decided to create a separate CSS file (called PrintPreview.css) to overwrite the following MOSS CSS classes:</p>
<div class="container">
/* Hide MOSS Globa Links, title, banner and Top Nav area */<br />
.ms-globalTitleArea {display:none;}<br />
.ms-globalbreadcrumb {display:none;}<br />
.ms-bannerContainer {display:none;}</p>
<p>/* Hide MOSS Page Title area */<br />
.ms-TitleAreaFrame {display:none;}<br />
.ms-titlearealeft {display:none;}<br />
.ms-titlearea {display:none;}<br />
.ms-pagetitle {display:none;}</p>
<p>/* Hide MOSS Bottom area */<br />
.ms-pagebottommarginleft {display:none;}<br />
.ms-pagebottommargin {display:none;}<br />
.ms-bodyareapagemargin {display:none;}<br />
.ms-pagebottommarginright {display:none;}</p>
<p>/* Hide MOSS quick launch area */<br />
.ms-navframe {display:none;}<br />
.ms-pagemargin {display:none;} </p>
<p>/* Hide MOSS Editor tool bar menu to prevent user from editing a comment*/<br />
.ms-rtetoolbarmenu {display:none;}</p>
<p>/* Remove border from MOSS body area */<br />
.ms-bodyareaframe {border:none 0px;}
</p></div>
<p>Since the <strong>Print Preview</strong> button was going to be added to an existing User Control (wrapped in a Web Part), I then added the following JavaScript code to the markup page of each user control.  Doing so will also allow you to hide specific elements you might not want to be displayed in the print preview window:</p>
<div class="container">
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>    //Function to print Web Part<br />
    function PrintPreview() {<br />
        var sUrl = window.location.href + &#8216;&amp;PrintPreview=true&#8217;;</p>
<p>        if (window.location.href.indexOf(&#8216;?&#8217;) == -1) {<br />
            sUrl = window.location.href + &#8216;?PrintPreview=true&#8217;;<br />
        }</p>
<p>        window.open(sUrl, &#8220;_blank&#8221;, &#8220;width=800,height=600,resizable=1,toolbar=1,status=1,titlebar=1,menubar=1&#8243;, true);<br />
    }</p>
<p>    if (window.location.href.indexOf(&#8220;PrintPreview=true&#8221;) &gt; -1) {<br />
         //This is where you can hide custom elements by ID or name<br />
         //For example here is the code to hide a command button with an ID of &#8220;button1&#8243;<br />
        document.getElementById(&#8216;button1&#8242;).style.display = &#8216;none&#8217;;</p>
<p>        //Load PrintPreview CSS<br />
        SetPrinterFriendlyCSS();<br />
    }</p>
<p>    function SetPrinterFriendlyCSS() {<br />
        document.write(&#8216;&lt;link type=&#8221;text/css&#8221; href=&#8221;/_layouts/Customer/Application/PrintPreview.css&#8221; rel=&#8221;stylesheet&#8221; /&gt;&#8217;);<br />
    }</p>
<p>&lt;/script&gt;<br />
</DIV></p>
<p>To hide specific custom elements on your page, you could also add a &#8220;noprint&#8221; class attribute to each element you do not want to be rendered in the print preview mode.  The not print class will be added to the PrintPreview.css file:</p>
<div class="container">
/* Add NoPrint class to the original markup */<br />
.noprint {display:none;}
</div>
<p><br/></p>
<p>The last technique will be to overwrite the class attribute used by the element you are trying to hide:</p>
<div class="container">
/* Hide right column to hide custom action buttons in CustomXXX.ascx*/<br />
.col_actions {display:none;}
</div>
<p><br/></p>
<h2>About the Author</h2>
<p>Gilles Uréna is an independent SharePoint Consultant.  Gilles is the owner of SharePoint Global Services, an organization built from the ground up to provide consulting services on the SharePoint platform and surrounding technologies.  You can contact Gilles at <a href="mailto:gilles.urena@sharepointglobalservices.com">gilles.urena@sharepointglobalservices.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharepointglobalservices.com/2010/02/07/printer-friendly-css-and-print-preview-in-moss-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

