Better Print for SharePoint Page


/ Published in: JavaScript
Save to your folder(s)

.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;
}


Copy this code and paste it in your HTML
  1. function printPage(TargetContentID) {
  2.  
  3. try {
  4. var disp_setting = "toolbar=yes,location=no,directories=yes,menubar=yes,";
  5. disp_setting += "scrollbars=yes,width=710, height=600, left=100, top=50";
  6. var pgTitle = document.title;
  7. pgLogo = document.getElementById('logoLinkorTitle').innerHTML;
  8. pgTitleFrame = document.getElementById('breadcrumb').innerHTML;
  9. content_vlue = document.getElementById(TargetContentID).innerHTML;
  10. var docprint = window.open("", "", disp_setting);
  11. docprint.document.open();
  12. docprint.document.write('<html><he' + 'ad>');
  13. docprint.document.write('<link rel="stylesheet" type="text/css" href="/Style Library/CSS/PrintStyles.css"/>');
  14. docprint.document.write('<title>' + pgTitle + '</title>');
  15. docprint.document.write('</he' + 'ad><bo' + 'dy onLoad="self.print()"><left>');
  16. docprint.document.write(pgLogo);
  17. docprint.document.write(pgTitleFrame);
  18. docprint.document.write('<br />' + content_vlue);
  19. docprint.document.write('</left></body></html>');
  20. docprint.document.close();
  21. docprint.focus();
  22. }
  23. catch (Error) {
  24. window.print();
  25. }
  26. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.