alafr / SVG-to-PDFKit

Insert SVG into a PDF document created with PDFKit
MIT License
397 stars 111 forks source link

Devanagari Font not rendering properly #174

Open varadeth opened 1 year ago

varadeth commented 1 year ago

I am trying to convert svg with devanagari fonts and it is not rendering the way it was supposed to.

Following is the code that I am trying to use

const svg = fs.readFileSync('random.svg').toString();
const doc = new PDFDocument();
const fontData = fs.readFileSync('./NotoSansDevanagari/NotoSansDevanagari-Regular.ttf');
doc.registerFont('NotoSansDevanagari', fontData);
SVGToPDF(doc, svg, 0, 0, {fontCallback: () => {
      return 'NotoSansDevanagari';
    }})
doc.pipe(res)
doc.end()

Below is the svg file I am trying to convert certificate4 and it is getting converted to response.pdf