Return to Snippet

Revision: 50064
at September 29, 2011 08:05 by nickaranz


Updated Code
function printPage(TargetContentID) {
        
        try {            
            var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
            disp_setting += "scrollbars=yes,width=710, height=600, left=100, top=50";
            var pgTitle = document.title;
            pgLogo = document.getElementById('logoLinkorTitle').innerHTML;            
            pgTitleFrame = document.getElementById('breadcrumb').innerHTML;
            content_vlue = document.getElementById(TargetContentID).innerHTML;
            var docprint = window.open("", "", disp_setting);
            docprint.document.open();
            docprint.document.write('<html><he' + 'ad>');
            docprint.document.write('<link rel="stylesheet" type="text/css" href="/Style Library/CSS/PrintStyles.css"/>');
            docprint.document.write('<title>' + pgTitle + '</title>');
            docprint.document.write('</he' + 'ad><bo' + 'dy onLoad="self.print()"><left>');
            docprint.document.write(pgLogo);
            docprint.document.write(pgTitleFrame);
            docprint.document.write('<br />' + content_vlue);
            docprint.document.write('</left></body></html>');
            docprint.document.close();
            docprint.focus();
        }
        catch (Error) {
            window.print();
        }
    }

Revision: 50063
at August 6, 2011 07:44 by nickaranz


Initial Code
function printPage() {
        
        try {            
            var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
            disp_setting += "scrollbars=yes,width=710, height=600, left=100, top=50";
            var pgTitle = document.title;
            pgLogo = document.getElementById('logoLinkorTitle').innerHTML;
            //pgLogo += '<hr/><h3>' + pgTitle.substr(pgTitle.indexOf('-') + 1) + '</h3><br>';
            pgTitleFrame = document.getElementById('breadcrumb').innerHTML;
            content_vlue = document.getElementById('MainContentSection').innerHTML;
            var docprint = window.open("", "", disp_setting);
            docprint.document.open();
            docprint.document.write('<html><he' + 'ad>');
            docprint.document.write('<link rel="stylesheet" type="text/css" href="/Style Library/CSS/PrintStyles.css"/>');
            docprint.document.write('<title>' + pgTitle + '</title>');
            docprint.document.write('</he' + 'ad><bo' + 'dy onLoad="self.print()"><left>');
            docprint.document.write(pgLogo);
            docprint.document.write(pgTitleFrame);
            docprint.document.write('<br />' + content_vlue);
            docprint.document.write('</left></body></html>');
            docprint.document.close();
            docprint.focus();
       
        }
        catch (Error) {
            window.print();
        }
    }

Initial URL

                                

Initial Description
.zz1_logoLinkId_1
{
	color: #fff;
	background-image:url("/_layouts/Images/HLLMRKLINK/Logo.gif");
	background-repeat:no-repeat;
	background-position:15px 10px;
	background-color:#67507e;
	display:block;
	width: 170px;
	height: 88px;
	overflow: hidden;
	text-indent: -9999px;
}
a:Link, a:visited
{
    color:#67507e;
}
.pageTitle
{
    font-weight:bold;  
    font-size:15pt;
    margin-top:15px;  
}
#MSOMenu_WebPartMenu
{
    display:none;
}
.pageContent p
{
    margin-top:0;
    padding-top:0;
}
#ctl00_ContentMap
{
    margin-top:15px;
}

Initial Title
Better Print for SharePoint Page

Initial Tags
css, sharepoint

Initial Language
JavaScript