参考实现代码:
- <div class="blockcode"><blockquote> <script type="text/javascript">
- let viewer;
- function loadViewer() {
- var viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- reportID: 'Sqlserver多值参数报表1.rdlx',
- //reportParameters: [{ name: 'P1', values: [1,2,3] }
- //],
- reportService: {},
- setting: {
- ZoomType: 'fitpage'
- }
- });
- pdfExportButton = {
- key: 'pdfExternalExportButton',
- iconCssClass: 'mdi mdi-file',
- text: "PDF Export",
- title: "PDF Export",
- checked: true,
- enabled: true,
- action: function (item) {
- var settings = { title: 'Invoice List', userPassword: 'user_Pwd' };
- var cancelCallback = function () {
- return false;
- }
- viewer.export('pdf', settings, { cancel: cancelCallback })
- .then(result => result.download("Exported_PDF"));
- }
- };
- viewer.toolbar.desktop.addItem(pdfExportButton);
- }
- </script>
复制代码
|