Auto-resize pages rendered in viewer

Stimulsoft Reports.JS discussion
Post Reply
reeax
Posts: 11
Joined: Tue Dec 05, 2017 7:29 pm

Auto-resize pages rendered in viewer

Post by reeax »

Hi,

I have noticed that rendered report pages in your JS viewer do not scale to fit the available page space, but simply show scrollbars. Competitors' products DO scale. Predefined fixed size is not an option, because the available space is almost always dynamic depending on the user's screen size.

This is a serious flaw in 2017. But perhaps am I missing something? Please advise.

Thanks
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Auto-resize pages rendered in viewer

Post by HighAley »

Hello.

Sorry, maybe we don't understand you right.
It's possible to scale a report to a Page Width and Height.

Thank you.
reeax
Posts: 11
Joined: Tue Dec 05, 2017 7:29 pm

Re: Auto-resize pages rendered in viewer

Post by reeax »

Hi,

It's probably me that don't get it, as I just started. Let's say I have the following code

Code: Select all

//set viewer
        var options = new Stimulsoft.Viewer.StiViewerOptions();
        options.width = "400px";
        var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
        viewer.report = report;
        viewer.renderHtml("viewer");
Instead of having the report page 100% rendered within these 400px, I only get half of the page displayed. It seems pretty obvious that the full report should be rendered within the indicated width.

Also, if for example I use relative size for the report container in my code

Code: Select all

<div id='viewer' style='width: 50%;'></div>
and set

Code: Select all

options.width = "100%";
I expect that the rendered report resizes automatically when I resize the browser's tab.

Thanks for your help.
reeax
Posts: 11
Joined: Tue Dec 05, 2017 7:29 pm

Re: Auto-resize pages rendered in viewer

Post by reeax »

Hello

I found an answer to "auto-resizing" - in addition to setting the report width during initialization, you also have to set zoom as follows:

Code: Select all

options.toolbar.zoom = Stimulsoft.Viewer.StiZoomMode.PageWidth;
Then the report will take the available amount of space.
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Auto-resize pages rendered in viewer

Post by HighAley »

Hello.

The 100% report zoom is a little different.
It comes from our other products. It the scale of the size of the report but not relative size of the page.
You have found the right option.

Thank you.
Post Reply