Page 2 of 2

Re: Print Issue

Posted: Mon Sep 07, 2020 6:15 am
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.

Re: Print Issue

Posted: Thu Sep 24, 2020 6:38 pm
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

Re: Print Issue

Posted: Sat Sep 26, 2020 8:28 am
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;
    }

Re: Print Issue

Posted: Tue Sep 29, 2020 9:11 am
by BCS
Thank you for I will give it a try.

Re: Print Issue

Posted: Wed Sep 30, 2020 2:35 pm
by Andrew
Hello,

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