Solved

Need to hide Menu, Tool, and Address bar when opening pdf document in IFrame

Posted on 2004-04-23
9
3,600 Views
Last Modified: 2008-03-17
Is there a way to hide the toolbar, menu bar, and address bar at the top of the page when opening a pdf document in a new window.  Or is there a way to prevent the user from printing the pdf from the menu or tool bar.  What is happening is the user are pressing the print button on the tool bar and they get a blank document, when they should instead be pressing the print button on the adobe tool bar.  I have the pdf's opening in an IFrame.

Thanks
0
Comment
Question by:geohix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
9 Comments
 
LVL 5

Expert Comment

by:bitter_chicken
ID: 10901093
hey geohix - not a prob with a bit of javascript

------------------------

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Open New Window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>
<a href="#" onClick="openBrWindow('pdffile.pdf','pdffile','width=400,height=400')">open pdf doc</a>
</body>
</html>
0
 
LVL 5

Expert Comment

by:bitter_chicken
ID: 10901106
In the example I posted, I didn't define any 'features' other than width or height, so the window lacks scrollbars, menubars, etc
0
 
LVL 5

Expert Comment

by:bitter_chicken
ID: 10901127
this link (in place of the one in my previous example) would show the page with all the extras (for your reference)
<a href="#" onClick="openBrWindow('pdffile.pdf','pdffile','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=400,height=400')">open pdf doc</a>
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 5

Expert Comment

by:bitter_chicken
ID: 10901138
how is that? 6 min response! lol
;-) hope it helped
0
 
LVL 5

Expert Comment

by:bitter_chicken
ID: 10901147
hold on - why are you opening them in an IFrame?
0
 

Author Comment

by:geohix
ID: 10901740
Here is my main page that I call the link from

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/HR.dwt" codeOutsideHTMLIsLocked="false" -->
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Kenwal Steel Corporation Intranet</title>
<!-- InstanceEndEditable --><link rel="stylesheet" href="emx_nav_left.css" type="text/css">
<script type="text/javascript">
<!--
var time = 3000;
var numofitems = 9;

//menu constructor
function menu(allitems,thisitem,startstate){
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = 9;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}
                        
function closesubnav(event){
  if ((event.clientY <48)||(event.clientY > 107)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
      shutdiv.style.visibility='hidden';
    }
  }
}
// -->
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.style1 {
      font-size: 24px;
      font-weight: bold;
}
-->
</style>
</head>
<body onmousemove="closesubnav(event);">
<div class="skipLinks">skip to: <a href="#content">page content</a> | <a href="pageNav">links on this page</a> | <a href="#globalNav">site navigation</a> | <a href="#siteInfo">footer (site information)</a> </div>
<div id="masthead">
  <h1 id="siteName">&nbsp;</h1>
  <div id="utility">
    <div align="right"><a href="Main.htm">Home</a>      <!--| <a href="#">Accounting</a> -->
      | <a href="hr_home.htm">Human Resources</a>      <!--| <a href="#">ISO</a>
       | <a href="#">Outside Sales</a> | <a href="#">Pickler</a> | <a href="#">Production</a> -->
      | <a href="http://fax/rightfax">Right Fax Login</a>      <!--| <a href="#">Quality Control</a>-->
       | <a href="Support_home.htm">Support</a>
    </div>
  </div>
  <div id="globalNav">
    <img alt="" src="gblnav_left.gif" height="32" width="4" id="gnl"> <img alt="" src="glbnav_right.gif" height="32" width="4" id="gnr">
    <div id="globalLink">
      <a href="hr_policy/policymanual.htm" id="gl1" class="glink" onmouseover="ehandler(event,menuitem1);">Policy and Procedures </a>
        <a href="#" id="gl2" class="glink" onmouseover="ehandler(event,menuitem2);">Forms
      </a><a href="#" id="gl3" class="glink" onmouseover="ehandler(event,menuitem3);">Insurance Info
      </a><a href="#" id="gl4" class="glink" onmouseover="ehandler(event,menuitem4);">Benefits
      </a><a href="#" id="gl5" class="glink" onmouseover="ehandler(event,menuitem5);">Databases</a>
        <a href="#" id="gl6" class="glink" onmouseover="ehandler(event,menuitem6);">
      </a><a href="#" id="gl7" class="glink" onmouseover="ehandler(event,menuitem7);">
      </a><a href="#" id="gl8" class="glink" onmouseover="ehandler(event,menuitem8);">
      </a><a href="#" id="gl9" class="glink" onmouseover="ehandler(event,menuitem9);">
      </a>  
    </div>
    <!--end globalLinks-->
    <form id="search" action="">
      <input name="searchFor" type="text" size="10">
      <a href="">search</a>
    </form>
  </div>
  <!-- end globalNav -->
  <div id="subglobal1" class="subglobalNav">
  <!--  <a href="#">Link</a> | <a href="#">Link</a> | <a href="#">Link
    </a> | <a href="#">Link</a> | <a href="#">Link </a> | <a href="#">Link
    </a> | <a href="#">Training</a> -->
      
  </div>
  <div id="subglobal2" class="subglobalNav">
   <a href="hr_forms/benefit_forms/benefit_main_form.htm">Benefit Forms</a> | <a href="hr_forms/payroll_forms/payroll_form_main.htm">Payroll Forms </a> | <a href="hr_forms/insurance_forms/insurance_form_main.htm">Insurance Forms</a>| <a href="hr_forms/misc_forms/misc_main.htm">Misc. Forms</a>    
  </div>
  <div id="subglobal3" class="subglobalNav">
    <a href="hr_insurance_info/major_medical_main.htm">Major Medical</a> | <a href="hr_insurance_info/Dental.htm">Dental</a> | <a href="hr_insurance_info/vision.htm">Vision</a>      | <a href="hr_insurance_info/disability_ins.htm">Disability & Life/ADD Insurance</a> | <a href="hr_insurance_info/supplemental_insurance.htm">Supplemental Insurance</a>  
  </div>
  <div id="subglobal4" class="subglobalNav">
    <a href="hr_benefit/supplier_discount.htm">Auto Supplier Discount</a> | <a href="hr_benefit/401k.htm"> 401K</a> | <a href="hr_benefit/pto.htm">Paid Time Off</a> | <a href="hr_benefit/edu_reim.htm">Education Reimbursement</a>
      | <a href="hr_benefit/bond.htm">Bonds</a> | <a href="hr_benefit/flexible_spending.htm">Flexible Spending</a>
  </div>
  <div id="subglobal5" class="subglobalNav">
    <a href="#">Training</a> | <a href="#">Report of Injury</a>  | <a href="#">Out of class</a>  
  </div>
  <div id="subglobal6" class="subglobalNav">
    <a href="#">Link</a> | <a href="#">Link</a>  
  </div>
  <div id="subglobal7" class="subglobalNav">
    <a href="#">subglobal7 link</a> | <a href="#">subglobal7 link</a> | <a href="#">subglobal7
    link</a> | <a href="#">subglobal7 link</a> | <a href="#">subglobal7 link</a> | <a href="#">subglobal7
    link</a> | <a href="#">subglobal7 link</a>
  </div>
  <div id="subglobal8" class="subglobalNav">
    <a href="#">subglobal8 link</a> | <a href="#">subglobal8 link</a> | <a href="#">subglobal8
    link</a> | <a href="#">subglobal8 link</a> | <a href="#">subglobal8 link</a> | <a href="#">subglobal8
    link</a> | <a href="#">subglobal8 link</a>
  </div>
  <div id="subglobal9" class="subglobalNav">
    <a href="#">subglobal9 link</a> | <a href="#">subglobal9 link</a> | <a href="#">subglobal9
    link</a> | <a href="#">subglobal9 link</a> | <a href="#">subglobal9 link</a> | <a href="#">subglobal9
    link</a> | <a href="#">subglobal9 link</a>
  </div>
 
<!-- end masthead -->

<div id="pagecell1">
  <!--pagecell1-->
  <img alt="" src="tl_curve_white.gif" height="6" width="6" id="tl"> <img alt="" src="tr_curve_white.gif" height="6" width="6" id="tr">
  <div id="breadCrumb">
  </div>
  <!-- InstanceBeginEditable name="Body" -->
  <div id="pageName">
    <h2>Human Resources </h2>
    <p>&nbsp;</p>
    <p>KENWAL STEEL CORP. is an employee-oriented organization, that emphasizes our people as the source of our strength. In keeping with that emphasis, we listen to you and try to balance your concerns against the business evnivronment in which all of us must compete.</p>
    <p>The Company's objective is to offer competitive pay and benefits; relate increases in pay to job performance; and profide a safe and healthful work environment </p>
    <h1 align="center"><a href="#">Upcoming Training</a></h1>
    <h1 align="center">&nbsp;</h1>
    <h1 align="center"><a href="#">Events</a></h1>
  </div>
  <!-- InstanceEndEditable -->
  <div id="siteInfo">
     <a href="About.htm">About Us</a> | <a href="#">Site
    Map</a> | <a href="#">Privacy Policy</a> | <a href="mailto: kd_network@kenwal.com">Contact Us</a> | &copy;2004
    Kenwal Steel Corp
  </div>
</div>
<!--end pagecell1-->
<br>
<script type="text/javascript">
    <!--
      var menuitem1 = new menu(9,1,"hidden");
                  var menuitem2 = new menu(9,2,"hidden");
                  var menuitem3 = new menu(9,3,"hidden");
                  var menuitem4 = new menu(9,4,"hidden");
                  var menuitem5 = new menu(9,5,"hidden");
                  var menuitem6 = new menu(9,6,"hidden");
                  var menuitem7 = new menu(9,7,"hidden");
                  var menuitem8 = new menu(9,8,"hidden");
                  var menuitem9 = new menu(9,9,"hidden");
    // -->
    </script>
</body>
<!-- InstanceEnd --></html>

The link that I am looking at in particular is called Policy and Procedures.  Looking at your response I mis-stated, I don't want to open in a new window, I want a particular page that has an pdf file in IFrame not to have the bars at the top or at minimum the print options...  Here is the page that I don't want the bars on...

It is all the same except in the body I have this command

 <!-- InstanceBeginEditable name="Body" -->
 
  <div id="pageName">
   <IFRAME SRC="dearpol.pdf" WIDTH="100%" HEIGHT="600"></IFRAME>

  </div>
0
 
LVL 5

Accepted Solution

by:
bitter_chicken earned 50 total points
ID: 10902199
Ok - 1 easy way(s) to achieve this
1. Encrypt it in acrobat (this should disable print options) - but there is another easy way, handy you're using an iframe, actually!
2. Note: this only works in IE;
  - create the iframe as such:
  <table width="100%"><tr><td>
   <IFRAME SRC="random.pdf" WIDTH="100%" HEIGHT="600" hspace="-50" vspace="-10"></IFRAME>
   </td></tr></table>
you have to create a table (not a div tag) otherwise it will 'float away'
 - just fiddle the hspace with negative values until you block the appropriate part of the pdf file! Easy, huh? Good for including content from other websites without their headers ;-) not that i'd do that

3. ::::::::Ok; now ignore the previous two points :) heres a better way (cross-browser compatibility):::::::::::::::::

-------------------------------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.iframemargins {
      margin-top: -55px;
}
-->
</style>
</head>

<body><table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><iframe src="pdffile.pdf" width="100%" height="600px" scrolling="auto" class="iframemargins"></iframe></td>
  </tr>
</table>

</body>
</html>

----------------------------------------------------

just apply it to your page as necessary. This just uses css to replicate the vspace and hspace property. The setting (-55px) worked for me (cut off all the acrobat stuff)

hope this helps :-)
ps. this is a lot for 50 measly points hint hint nudge nudge
0
 

Author Comment

by:geohix
ID: 10902457
Sorry, about the points... You are right, this was a lot more than I expected.  I am new to the forum (as if you couldn't tell) Is there a way to up the points?
0
 
LVL 5

Expert Comment

by:bitter_chicken
ID: 10906159
yeah - there is a box to up the points, but i think that disappears once you've accepted an answer :(
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to dynamically set the form action using jQuery.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question