"html to pdf using jspdf rtl support" Code Answer

4

in my component i used this function:

htmltopdf(){
    const elementtoprint = document.getelementbyid('content');
    const pdf = new jspdf();
    pdf.addhtml(elementtoprint, () => {
        pdf.save('report.pdf');
    });

in my html: i put div tag that warp all... and with id="content" i use the attribute dir="rtl"

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

don't forget to add this script:

<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
By aganders3 on June 13 2022

Answers related to “html to pdf using jspdf rtl support”

Only authorized users can answer the Search term. Please sign in first, or register a free account.