Print Issue

Stimulsoft Reports.JS discussion
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Issue

Post by Lech Kulikowski »

Hello,

> As a side question is there an API for the Find function you guys have in your toolbar, so that it might be used externally?

Could you explain your issue in more detail?

Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post by BCS »

Apologies I was on vacation, if I wanted to use my own Find Text function similar to your binoculars button, is there an API to call for that similar to NextPage, PrevPage, etc
Lech Kulikowski
Posts: 7292
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Issue

Post by Lech Kulikowski »

Hello,

You can use the following actions:

Code: Select all

var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
            viewer.renderHtml("content");
            viewer.jsObject.postAction("NextPage"); //FirstPage, PrevPage, LastPage
and actions:

Code: Select all

switch (action) {
        case "Refresh":
            break;

        case "Print":
            switch (this.options.toolbar.printDestination) {
                case "Pdf": this.postPrint("PrintPdf"); break;
                case "Direct": this.postPrint("PrintWithoutPreview"); break;
                case "WithPreview": this.postPrint("PrintWithPreview"); break;
                default: this.controls.menus.printMenu.changeVisibleState(!this.controls.menus.printMenu.visible); break;
            }
            return;

        case "Open":
            var openReportDialog = this.InitializeOpenDialog("openReportDialog", function (fileName, filePath, content) {
                openReportDialog.jsObject.postOpen(fileName, content);
            }, ".mdc,.mdz,.mdx");
            openReportDialog.action();
            return;

        case "Save":
            this.controls.menus.saveMenu.changeVisibleState(!this.controls.menus.saveMenu.visible);
            return;

        case "SendEmail":
            this.controls.menus.sendEmailMenu.changeVisibleState(!this.controls.menus.sendEmailMenu.visible);
            return;

        case "Zoom":
            this.controls.menus.zoomMenu.changeVisibleState(!this.controls.menus.zoomMenu.visible);
            return;

        case "ViewMode":
            this.controls.menus.viewModeMenu.changeVisibleState(!this.controls.menus.viewModeMenu.visible);
            return;

        case "FirstPage":
        case "PrevPage":
        case "NextPage":
        case "LastPage":
            if (action == "FirstPage") this.reportParams.pageNumber = 0;
            if (action == "PrevPage" && this.reportParams.pageNumber > 0) this.reportParams.pageNumber--;
            if (action == "NextPage" && this.reportParams.pageNumber < this.reportParams.pagesCount - 1) this.reportParams.pageNumber++;
            if (action == "LastPage") this.reportParams.pageNumber = this.reportParams.pagesCount - 1;
            if (this.controls.reportPanel.pagesNavigationIsActive()) {
                this.scrollToPage(this.reportParams.pageNumber);
                if (this.controls.toolbar) this.controls.toolbar.changeToolBarState();
                return;
            }
            break;

        case "FullScreen":
            this.changeFullScreenMode(!this.options.appearance.fullScreenMode);
            return;

        case "Zoom25": this.reportParams.zoom = 25; break;
        case "Zoom50": this.reportParams.zoom = 50; break;
        case "Zoom75": this.reportParams.zoom = 75; break;
        case "Zoom100": this.reportParams.zoom = 100; break;
        case "Zoom150": this.reportParams.zoom = 150; break;
        case "Zoom200": this.reportParams.zoom = 200; break;

        case "ZoomOnePage":
        case "ZoomPageWidth":
            {
                if (this.options.toolbar.displayMode == "Separated") {
                    this.controls.toolbar.controls.ZoomOnePage.setSelected(action == "ZoomOnePage");
                    this.controls.toolbar.controls.ZoomPageWidth.setSelected(action == "ZoomPageWidth");
                }
                this.reportParams.zoom = action == "ZoomPageWidth" ? parseInt(this.controls.reportPanel.getZoomByPageWidth()) : parseInt(this.controls.reportPanel.getZoomByPageHeight());
                break;
            }

        case "ViewModeSinglePage":
            this.reportParams.viewMode = "SinglePage";
            break;

        case "ViewModeContinuous":
            this.reportParams.viewMode = "Continuous";
            break;

        case "ViewModeMultiplePages":
            this.reportParams.viewMode = "MultiplePages";
            break;

        case "ViewModeMultiPage":
            this.reportParams.viewMode = "MultiPage";
            this.reportParams.multiPageContainerWidth = this.controls.reportPanel.offsetWidth;
            this.reportParams.multiPageContainerHeight = this.controls.reportPanel.offsetHeight;
            this.reportParams.multiPageMargins = 10;
            break;
case "GoToPage":
            this.reportParams.pageNumber = this.controls.toolbar.controls["PageControl"].textBox.getCorrectValue() - 1;
            if (this.controls.reportPanel.pagesNavigationIsActive()) {
                this.scrollToPage(this.reportParams.pageNumber);
                if (this.controls.toolbar) this.controls.toolbar.changeToolBarState();
                return;
            }
            break;

        case "BookmarkAction":
            if (this.reportParams.pageNumber == bookmarkPage || this.reportParams.viewMode != "SinglePage") {
                this.scrollToAnchor(bookmarkAnchor);
                return;
            }
            else {
                this.reportParams.pageNumber = bookmarkPage;
                this.options.bookmarkAnchor = bookmarkAnchor;
            }
            break;

        case "Bookmarks":
            this.controls.bookmarksPanel.changeVisibleState(!this.controls.buttons["Bookmarks"].isSelected);
            return;

        case "Parameters":
            this.controls.parametersPanel.changeVisibleState(!this.controls.buttons["Parameters"].isSelected);
            return;

        case "Find":
            this.controls.findPanel.changeVisibleState(!this.controls.toolbar.controls.Find.isSelected);
            return;

        case "About":
            this.controls.aboutPanel.changeVisibleState(!this.controls.toolbar.controls.About.isSelected);
            return;

        case "Design":
            this.postDesign();
            return;

        case "Pin":
            if (this.controls.toolbar) this.controls.toolbar.changePinState(!this.options.toolbar.autoHide);
            return;

        case "Submit":
            this.reportParams.editableParameters = null;
            this.reportParams.pageNumber = 0;
            if (this.options.isMobileDevice) this.controls.parametersPanel.changeVisibleState(false);
            this.postInteraction({ action: "Variables", variables: this.controls.parametersPanel.getParametersValues() });
            return;

        case "Reset":
            this.options.parameters = {};
            this.controls.parametersPanel.clearParameters();
            this.controls.parametersPanel.addParameters();
            return;

        case "Editor":
            this.SetEditableMode(!this.options.editableMode);
            return;
    }
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post by BCS »

Thank you for I will give it a try.
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Re: Print Issue

Post by Andrew »

Hello,

Okay, let us know about the result.
Thank you.
Post Reply