【问题标题】:is there a way to print lightning web component to pdf有没有办法将闪电网络组件打印为 pdf
【发布时间】:2022-06-12 08:15:46
【问题描述】:

我正在尝试将 lwc 组件打印为 pdf,不想使用 vf 页面,因为它需要我们在 lwc 和 vf 页面中维护字段添加。 我尝试使用 jspdf 库,但无法查询元素和打印。下面是我一直在尝试工作的js函数,

generatePdf(){
     var source = window.document.getElementsByTagName('c-org_roll-entry-details');
     var specialElementHandlers = {
         '#hidden-element': function (element, renderer) {
             return true;
         }
     };
    const { jsPDF } = window.jspdf;
    const pdf = new jsPDF({
    });
    pdf.fromHTML(source, 15, 15, {
      'width': 170,
      'elementHandlers': specialElementHandlers
  });
    pdf.save('summary.pdf');
    //console.log(pdf.output('datauristring'));

    
}

【问题讨论】:

    标签: salesforce salesforce-lightning lwc


    【解决方案1】:

    不,唯一的选择是使用 VF 页面

    【讨论】:

      猜你喜欢
      • 2011-05-26
      • 2016-07-26
      • 2020-03-11
      • 2022-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-07
      • 1970-01-01
      相关资源
      最近更新 更多