Html 使用 jsPDF rtl 支持转为 pdf

Html to pdf using jsPDF rtl support

我正在尝试使用 angular 将 html 转换为带有 jsPDF 的 pdf 5
这是我的代码:

import * as jsPDF from "jspdf";
.
.
.
htmlToPdf(){
var doc=new jsPDF();
var specialElementHandlers = {
  '#content' : function(element,render) {return true;}
};

doc.fromHTML(document.getElementById('content'), 20,20,{
           'width':500,
      'elementHandlers': specialElementHandlers,
});

doc.save('Reports.pdf');
}

我正在尝试以从右到左的方向导出 pdf 而没有 sucsses
当我尝试这个命令时:

doc.viewerPreferences({Direction: 'R2L'});

我收到一个错误:'property does not exist on type "jsPdf" '
顺便说一句,在我的 html 或 css 中,我尝试放置方向属性,但它没有帮助。还是从左到右

在我的组件中我使用了这个函数:

htmlToPdf(){
    const elementToPrint = document.getElementById('content');
    const pdf = new jsPDF();
    pdf.addHTML(elementToPrint, () => {
        pdf.save('report.pdf');
    });

在我的 html 中:我放置了 div 标签来扭曲所有...并且 id="content" 我使用属性 dir="rtl"

<div id="content" dir="rtl">
.
.
.
</div>

别忘了添加这个脚本:

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>