I'm attempting to convert HTML to PDF using jsPDF in an Angular 5 project.
Below is the code I have so far:
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');
}
I'm trying to export the PDF with right-to-left direction but haven't had success.
When I use this command:
doc.viewerPreferences({Direction: 'R2L'});
I receive an error: 'property does not exist on type "jsPdf" '
I've also tried adding the direction attribute in my HTML and CSS, but it still remains left to right.