diff --git a/src/controller/admin/protocolController.ts b/src/controller/admin/protocolController.ts index d6f0310..5af549b 100644 --- a/src/controller/admin/protocolController.ts +++ b/src/controller/admin/protocolController.ts @@ -140,9 +140,13 @@ export async function getProtocolPrintoutByIdAndPrint(req: Request, res: Respons let protocolId = parseInt(req.params.protocolId); let printoutId = parseInt(req.params.printoutId); - let printouts = await ProtocolPrintoutService.getById(printoutId, protocolId); + let printout = await ProtocolPrintoutService.getById(printoutId, protocolId); - res.json(ProtocolPrintoutFactory.mapToSingle(printouts)); + res.sendFile(process.cwd() + `/export/${printout.filename}.pdf`, { + headers: { + "Content-Type": "application/pdf", + }, + }); } /**