We are using this code to download the pdf file but we are getting problem. i want when i hit this route then pdf file will download.
But when i hit this api in postman and click on the download button then pdf file download. So i wnat to download the pdf file with data.
What I have tried:
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);
});
%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�װ�).�?�����`�������/��