I am defining my remote method of loopback as follows

```
Visitor.remoteMethod('getVisitorsPDF', {
description: 'Get visitors list in PDF file',
accepts: [
  { arg: 'res', type: 'object', http: { source: 'res' } },
  { arg: 'dateInStart', type: 'string' },
  { arg: 'dateInEnd', type: 'string' },
  { arg: 'employeeSiteId', type: 'string' },
  { arg: 'name', type: 'string' },
  { arg: 'visitorCompany', type: 'string' },
  { arg: 'employeeName', type: 'string' },
  { arg: 'typeId', type: 'number' },
  { arg: 'shift', type: 'number' }
],
returns: {},
http: { path: '/getpdf', verb: 'get' }
});

```

and its implementation is as follows:

```
   Visitor.app.models.user.testAccess(res).then(
      (current) => {
        ....
        res.set('Content-Type', 'application/pdf');
        res.set('Content-Disposition', 'attachment;filename="visitors.pdf"');
        ...
        Visitor._getVisitors(query, current).then(
          (visitors) => {
            let visitorsFiltered = visitors.filter((v) => {
              if (!v.tztimeIn) return v;
              let d = v.timeIn + v.tztimeIn * 60000;
              if (dStart < d && d < dEnd) return v;
            });
            Visitor._getVisitorsPDF(visitorsFiltered)
              .then(result => {
                res.send(result);
              },
              );
          },
        );

      }
    )
  };

```

And the function that is generating pdf is follows:

```
Visitor._getVisitorsPDF = async function (visitors) {
    ...
    const rows = tempData;
    const doc = new jsPDF();
    doc.autoTable(columns, rows);
    doc.save('visitors.pdf');

  } 

```

how to send this doc back as application/pdf response ? I am stuck here