Send json data in pdf format to printer


Hi..Iam retreving data from an api using $ on clicking a button i want to send this json data to printer in pdf format..i tried this code

var file = new Blob([data], { type: 'application/pdf' });
var fileURL =window.URL.createObjectURL(file);
but this is not working for ie..can anyone suggest the method that works for all browsers....