Here is my pdfService, in Angular project looks below. When I call this.formatter() method inside myPDF is not working.
export class pdfService { 
    formatter(value: number): string {
        return new Intl.NumberFormat('en-IN', {style: 'decimal', currency: 'INR'}).format(value);
    }
    myPDF() {
        const doc = new jsPDF();
        doc.text('Values', 10, 25, 'left');
        doc.text(this.formatter(1000), 10, 25, 'left');
        doc.text(this.formatter(10000), 10, 35, 'left');
        window.open(doc.output('bloburl'));
    }
}
if I write method inside myPDF method, it works. below is code.
function formatter(value: number): string {
    return new Intl.NumberFormat('en-IN', {style: 'decimal', currency: 'INR'}).format(value);
}
I need to use formatter method in multiple PDF methods, so where do I write it?
Note: repeating formatter method in all PDF methods is one option but not the correct way.
 
     
    