How to Hide Specific Paper Sizes in the JavaScript Report Viewer
The Bold Reports JavaScript Report Viewer provides users with multiple paper size options (such as A4, Letter, Legal, etc.) when exporting or printing reports. In some scenarios, you may want to restrict or hide specific paper sizes to meet organizational standards, printer compatibility, or compliance requirements.
Bold Reports allows this customization through the hidePagePaperSizes property during viewer initialization.
This article explains how to use this property to control which paper sizes are hidden from the Report Viewer UI.
Steps to Hide Paper Sizes
1. Configure the hidePagePaperSizes Property
- Add the
pageSettingsobject to your initialization code. Use thehidePagePaperSizesproperty to specify an array of paper sizes that you want to hide.<div id="container"></div> <script> $("#reportviewer").boldReportViewer( { pageSettings: { hidePagePaperSizes: ['A3', 'A4', 'Letter'] } } ); </script>Configuration Option Description hidePagePaperSizesSpecifies an array of paper sizes to hide in the export dialog. Any paper size included in this list will not appear in the page settings during export.
2. Preview the Changes
- Run your application and open the Report Viewer to confirm that the selected paper sizes are no longer displayed in the export dialog.
Before hiding the paper sizes - All the paper sizes are included in the export dialog.
After hiding the paper sizes - The selected paper sizes are not available in the export dialog i.e., ‘A3’, ‘A4’, ‘Letter’
Conclusion
By hiding specific paper sizes in the Report Viewer, you can improve the user experience and ensure exported reports follow your preferred formatting standards.
Download the sample application here for further reference.