在使用fluentreports API打印之前,是否可以将pdf旋转90度?

时间:2019-05-17 15:41:17

标签: javascript node.js report quasar-framework

我正在使用fluentreports在服务器上生成报告,并将其发送给客户端进行打印。我已经完成所有工作,但是打印格式仍然不适合我的上司,因为他们在企业中使用的纸张是法律规定尺寸的一半,并且如果按我现在设置的方式以纵向打印报告,则不会。不适合他们使用的纸张。我需要以纵向方式生成报告,因为我需要以这种方式描述信息,但是我想知道是否无论如何我都可以在打印之前将文档旋转90度,以使其适合我必须使用的纸张使用fluentreports API。我可以使用“选项”中的任何属性来使这种情况发生吗?

在客户端上打印pdf的功能:

printIframe: function(url) {
      var proxyIframe = document.createElement('iframe');
      var body = document.getElementsByTagName('body')[0];
      body.appendChild(proxyIframe);
      proxyIframe.style.width = '100%';
      proxyIframe.style.height = '100%';
      proxyIframe.id='iframe'
      proxyIframe.style.display = 'none';

      var contentWindow = proxyIframe.contentWindow;
      contentWindow.document.open();

      // Set dimensions according to your needs.
      // You may need to calculate the dynamically after the content has loaded
      contentWindow.document.write('<iframe src="' + url + '" width="1000" height="1800" frameborder="0" marginheight="0" marginwidth="0">');
      contentWindow.document.close();
      var x=0
      var func=function (event) {
        if(x===0)
        {
          body.removeChild(proxyIframe)
          ++x
        }
        else
        {
          document.removeEventListener('mousemove', func)
        }
      }
      contentWindow.document.body.onload=() => {
        contentWindow.document.body.focus()
        setTimeout(()=>{
          document.addEventListener('mousemove', func)
        }, 5000)
      }
    },

生成报告的服务器上的代码:

var options = {
              landscape: true,
              data: rows,
              paper: 'A5',
              autoPrint: true,
              fullScreen: true
            }
            var myreport=new Report.Report("buffer", options)
              .data(rows)
              .pageHeader(repairheaderFunction)
              .detail(repairdetailFunction)
              .pageFooter(repairfooterFunction)
            myreport.render(function (err, data) {
              callbackfn({authenticated: true, pdf: 'data:application/pdf;base64,' + data.toString('base64')})
            })

0 个答案:

没有答案
相关问题