The JasperReports plug-in allows you to preview a report (using the JasperViewer) by setting the .jasperPluginRMI.runReport() output format property as follows:
OUTPUT_FORMAT.VIEW
The JasperViewer has three view settings:
Actual Page Size (100%)
Fit Entire Page
Fit Page Width
with 100% Page Size being the default.
I would like to be able to set Fit Entire Page as the default. Does anyone know how to do this?
This could be done, but would require changes to the plugin itself. See CustomizedJasperViewer class in the provider for more information (if you want to tackle that on your own).
Even better the plugin should also not only be able to set the default view for the jasper viewer window but also:
able to set the size of the window
set the position of the window -1 -1 would be ideal , (currently always defaults to the primary display, this is a jarring effect when using multiple monitors))
In developer, I updated the Jasper Report plug-in and bean to v3.3.0 b1 (all files are dated 11/25/2011) and added one line of code to set the display mode in the bean:
elements.bean_jasper_preview.displayMode = JR_SVY_VIEWER_DISPLAY_MODE.FIT_WIDTH <--- ADDED LINE OF CODE
elements.bean_jasper_preview.showReport( fs, reportName, reportArguments )
and received the following run-time error message:
ReferenceError: “JR_SVY_VIEWER_DISPLAY_MODE” is not defined.
Without the new line of code, it works fine. The new code line was added using the auto-completion when in the bean. Is this a bug, or did I not code this correctly?
In developer, I updated the Jasper Report plug-in and bean to v3.3.0 b1 (all files are dated 11/25/2011) and added one line of code to set the display mode in the bean:
elements.bean_jasper_preview.displayMode = JR_SVY_VIEWER_DISPLAY_MODE.FIT_WIDTH <--- ADDED LINE OF CODE
and received the following run-time error message:
> ReferenceError: "JR_SVY_VIEWER_DISPLAY_MODE" is not defined.
Without the new line of code, it works fine. The new code line was added using the auto-completion when in the bean. Is this a bug, or did I not code this correctly?
Thanks!
Kim, please add one piece of code before yours: “plugins.jasperPluginRMI”.
The viewer’s constants are in the plugin’s code (so it’s needed to have both plugin and bean updated to latest version, but you already have that).
You need that because of the way plugins are loaded (before using the constants provided by the Jasper plugin, first the plugin has to be touched).
I hope this helps.
Thanks for the tip and the explanation, Andrei…it now works! You may want to add this tip to your release notes on Servoy Forge, so that others do have the same problem (at least, until Servoy v6.1 is released).