Hide save and print button

Stimulsoft Reports.JS discussion
Post Reply
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Hide save and print button

Post by jpgb »

I know how to hide them in the options object, but can i hide these buttons after the viewer is loaded?

thanks
JB
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Hide save and print button

Post by Edward »

Hi JB,

Yes, that is possible as well. Please check out the following approach of adding a new button:

And you could hide a button in a similar fashion as well.

Code: Select all

<head>
    <script>
        var options = new Stimulsoft.Viewer.StiViewerOptions();
        var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
        var report = new Stimulsoft.Report.StiReport();
        report.loadFile("Reports/SampleReportWithEditableText.mrt");
        viewer.renderHtml("viewerCont");
        viewer.report = report;

        var toolbarTable = viewer.jsObject.controls.toolbar.firstChild;
        viewer.jsObject.controls.toolbar.removeChild(toolbarTable);

        var userToolbar = document.createElement("div");
        viewer.jsObject.controls.toolbar.appendChild(userToolbar);
        
        var userToolButton = document.createElement("div");
        userToolButton.style.background = "red";
        userToolButton.style.width = userToolButton.style.height = "25px";
        userToolbar.appendChild(userToolButton);

        userToolButton.onclick = function () {
            viewer.jsObject.postExport(exportType, viewer.jsObject.getDefaultExportSettings(exportType));
        }

    </script>
</head>
<body>
    <div id="viewerCont"></div>
</body>

Thank you,
Edward
jpgb
Posts: 67
Joined: Tue Mar 15, 2016 11:42 am

Re: Hide save and print button

Post by jpgb »

Thanks!

JB
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Hide save and print button

Post by Lech Kulikowski »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply