Friday, March 11, 2011

Removing the PDF/HTML print option

I saw a post in the OTN forums asking how to disable the pdf option in the print menu for dashboards, if you want to do this for a particular dashboard then you can do this through javascript, here is a simple example:

var dateHeaderDiv = document.getElementById("dateHeader");
var dateHeaderPos = findPos(dateHeaderDiv);
dateHeaderDivYOffset = dateHeaderPos[1];
dateHeaderDivXOffset = dateHeaderPos[0];
var menuLink = getElementsByClassName("NQWMenuItem");
//Get the appropriate function for getting the HTML print
//output of the current page
for(i = 0; i < menuLink.length; i++)
   if(menuLink[i].name == "html")
      var onClickText = menuLink[i].onclick;
//Find the print icon and make it display the print page instead of the
//default menu for pdf or html print (because pdf print does not work
//properly with javascript narrative views)
var pdfParent = getElementsByClassName("DashboardFormatLinks");
for(i = 0; i < pdfParent.length; i++)
   for(j=0; j < pdfParent[i].childNodes.length; j++)
         if(pdfParent[i].childNodes[j].title == "Printer Friendly")
            pdfParent[i].childNodes[j].onclick = onClickText;

That acutally removes the PDF option and makes the print icon kick off the HTML print page straight away without showing the menu, it works in  You can then add that as a static text item with the HTML option ticked and add that to the dashboard.

If you want to remove the option to print to pdf all across the application then first find the controlmessages.xml file which lives in OracleBI\web\msgdb\messages and copy it to OracleBIData\web\msgdb\customMessages, if it the customMessages folder is not there then create it.  Now open the file, it looks like this:

<?xml version="1.0" encoding="utf-8"?>
<!--DO NOT MODIFY THIS FILE.  THIS FILE IS AUTOMATICALLY GENERATED AND IS REPLACED UPON UPGRADE OR REINSTALL.--><!--Contents of this file are Copyright (C) 2001-2005 by Siebel Systems, inc.--><!--Consult your Siebel Analytics Web documentation for how to override messages.  Note that some or all messages may not be overriden unless your license specifically allows for it.--><WebMessageTables xmlns:sawm=""><WebMessageTable lang="en-us" system="ControlMessagesSys" table="Messages">

<WebMessage name="kmsgAdminSysLogConcatenateNew"><HTML><nobr><sawm:param insert="1"/></nobr><br/><nobr><sawm:param insert="2"/></nobr></HTML></WebMessage>

<WebMessage name="kmsgAnswersBannerHeight"/>

<WebMessage name="kmsgAnswersBannerURL"/>

<WebMessage name="kmsgCatalogTabURL"/>

<WebMessage name="kmsgChangePasswordLink"><!--    <HTML><a insert="1"><sawm:messageRef name="kmsgUIChangePassword"/></a></HTML> --></WebMessage>

<WebMessage name="kmsgCustomLink"/>

<WebMessage name="kmsgDashboardAddToBriefbookLink"><HTML><a insert="1"><img align="absbottom" src="fmap:Portal/add2bb.gif" border="none"/></a></HTML><!--    <HTML><a insert="1"><img align="absbottom" src="fmap:Portal/add2bb.gif" border="none"/></a>&nbsp;<a insert="1"><sawm:messageRef name="kmsgPortalAddToBriefbook"/></a></HTML> --></WebMessage>

<WebMessage name="kmsgDashboardAlternateFormats"><HTML><span class="DashboardFormatLinks"><sawm:param insert="1"/></span>&nbsp;<span class="DashboardFormatLinks"><sawm:param insert="2"/></span>&nbsp;<span class="DashboardFormatLinks"><sawm:param insert="3"/></span></HTML></WebMessage>

<WebMessage name="kmsgDashboardPrinterFriendlyLink"><HTML><a href="javascript:void(null)" onclick="return NQWPopupMenu(event,'idDashboardPrintMenu', null, 'top')" title="@{title}"><img align="absbottom" src="fmap:Portal/PrinterFriendly.gif" border="none"/></a>
<div id="idDashboardPrintMenu" class="NQWMenu" onmouseover="NQWMenuMouseOver(event)"><sawm:messageRef name="kuiMenuShadowBegin"/><a class="NQWMenuItem" name="html" href="javascript:void(null)" onclick="return PortalPrint('@{htmlURL}[javaScriptString]', true);"><sawm:messageRef name="kmsgDashboardPrintHTML"/></a><sawm:if name="enablePDF"><a class="NQWMenuItem" name="pdf" href="javascript:void(null)" onclick="return PortalPrint('@{pdfURL}[javaScriptString]',@{bNewWindow});"><sawm:messageRef name="kmsgDashboardPrintPDF"/></a></sawm:if>          
<sawm:messageRef name="kuiMenuShadowEnd"/></div></HTML></WebMessage>

<WebMessage name="kmsgDashboardRefreshPageLink"><!-- title --><!-- portalPath --><!-- pageName --><HTML>
<A href="javascript:void(null)" onclick="RefreshPage('@{sawCmd}[javaScriptString]&PortalPath=@{portalPath}[javaScriptString]&Page=@{pageName}[javaScriptString]');return false;" title="@{title}"><img align="absbottom" src="fmap:Portal/dash_refresh.gif" border="none"/></A></HTML></WebMessage>

<WebMessage name="kmsgInOuterFrame"/>

<WebMessage name="kmsgJoinGroupLink"><HTML><a insert="1"><sawm:messageRef name="kmsgUIJoinGroup"/></a></HTML></WebMessage>

<WebMessage name="kmsgStaticWebGroups"><TEXT>Analytics Users</TEXT></WebMessage></WebMessageTable><WebMessageTable system="ViewGeneration" table="IQY">

<WebMessage name="kuiIQYContent"><!-- cmdPrefix = http://machine/path/saw.dll? --><!-- path      = /path/to/some/report --><!-- noSSO     = true | false --><TEXT>WEB<sawm:lineBreak/>1<sawm:lineBreak/><sawm:param name="cmdPrefix"/>Download&Format=excel&Extension=.xls&BypassCache=true&PathEncode=IQYEncode&Path=<sawm:param name="path"/><sawm:if name="noSSO">&NQUser=["Oracle BI User"]&NQPassword=["Oracle BI Password"]&SyncOperation=1</sawm:if><sawm:lineBreak/></TEXT></WebMessage></WebMessageTable></WebMessageTables>

The bit we care about in this case is the kmsgDashboardPrinterFriendlyLink in here you can see the bit that says:

<sawm:if name="enablePDF"><a class="NQWMenuItem" name="pdf" href="javascript:void(null)" onclick="return PortalPrint('@{pdfURL}[javaScriptString]',@{bNewWindow});"><sawm:messageRef name="kmsgDashboardPrintPDF"/></a></sawm:if> 

Removing all of that will disable the print to pdf option across the board as the option will no longer appear in the menu.

Restart the OBIEE services and you should see the change applied. 


  1. Hi,
    Instead of removing an option from the "Download" can we add an option?
    I have a requirement to download the OBIEE reports in MS Word. Can we edit the same file and add a tag to add "Download to Word" option.
    Any help or information that you can provide is much appreciated. Thanks.

  2. Thank you for sharing an interesting and very useful article. And let me share an article about health here I believe this is useful. Thank you :)

    Obat Alami untuk Menghentikan Menstruasi Berkepanjangan
    Obat Keloid Menahun
    Cara Mengobati Konjungtivitis (radang mata) secara Alami