send file

This commit is contained in:
Julian Krauser 2024-10-20 17:42:06 +02:00
parent 6f72c27d20
commit 624408c973

View file

@ -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",
},
});
}
/**