Set zoom mode in JSViewer initialization

Posted by: hafiz.hassan on 3 August 2022, 7:38 pm EST

    • Post Options:
    • Link

    Posted 3 August 2022, 7:38 pm EST

    Sample here show zoomType can set in JSViewer initialization.

    https://www.grapecity.com/activereportsnet/docs/latest/online/pure-js-integration.html

    <script type="text/javascript">
            GrapeCity.ActiveReports.JSViewer.create({
                element: '#viewer-id',
                reportService: {
                    url: 'api/reporting',
                },
                reportID: 'DemoReport.rdlx',
                settings: {
                    zoomType: 'FitPage'
                },
            });
        </script>
    
    1. However it is not working and I can’t find any reference to ‘zoomType’ inside jsViewer.min.js
    2. Also no details about ‘settings’ in JSViewer API documentation here:

      https://www.grapecity.com/activereportsnet/docs/latest/online/using-js-viewer.html
  • Posted 4 August 2022, 7:39 pm EST

    Hello,

    Please refer to the following points for the resolution of the above query:

    • To set the required zoomMode on initialization, we can use the documentLoaded property to set the required property.

    • To set the zoomMode according to factor, we should set the value of mode as 0, and set the value of factor accordingly (from 0 up to 3 where 0.5 indicate 50% and 3 = 300%)

    • To set the zoomMode as Fit to Width, we should set the value of mode as 1.

    • To set the zoomMode as PageFit, we should set the value of mode as 2.

    Please refer to the following code snippet:

     viewer = GrapeCity.ActiveReports.JSViewer.create({
                  element: '#viewerContainer',
                  documentLoaded: () => {
                      viewer._viewer.zoom = { mode: 1, factor: 0};
                  }
              });
    

    Please let us know if you have any further queries or concerns

    Regards

    Dushyant Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels