I am using jsPDF to create a PDF file. Some text has special characters. For e.g. instead using H2SO4 I want to write H₂SO₄.
Does jsPDF supports it ? Can someone please suggest how to do it?
jsPDF natively only supports ASCII. You can use UTF-8 using a custom font like this :
const doc = new jsPDF();
const myFont = ... // load the *.ttf font file as binary string
// add the font to jsPDF
doc.addFileToVFS("MyFont.ttf", myFont);
doc.addFont("MyFont.ttf", "MyFont", "normal");
doc.setFont("MyFont");
More information on their github