Pdf download functionality in node js

Posted 9 months ago by coderathore

router.get('/demo',function (req,res){ async function getinvoicelist(){

var chunks = []; var options = { method: 'GET', url: 'https://api.fortnox.se/3/invoices/31/preview',

request(options, function (error, response, body) {

console.log(body);

});

We are getting this when we console the body . We want when we hit this route then pdf file download in browser with data

%PDF-1.4 %���� 3 0 obj <</Length 1438/Filter/FlateDecode>>stream x��Y�r�6��+�Ɍ3S�xXڭ�h���IM���STB�n>�_�/p~!�^<H��N�xti���}��T�, ��&k��g���xU|*҂�Gk�JPSH#13�װ�).�?�����`�������/��

Please sign in or create an account to participate in this conversation.