package jnpf.bizcommon.onlyoffice.controller; import jakarta.validation.Valid; import jnpf.bizcommon.onlyoffice.entity.DmsPrintRenderRequest; import jnpf.bizcommon.onlyoffice.service.impl.DmsOnlyOfficePrintService; import jnpf.util.UserProvider; import lombok.RequiredArgsConstructor; import org.springframework.http.CacheControl; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/onlyoffice/dms-print") @RequiredArgsConstructor public class DmsOnlyOfficePrintController { private final DmsOnlyOfficePrintService service; @PostMapping(value = "/render", produces = MediaType.APPLICATION_PDF_VALUE) public ResponseEntity render(@RequestBody @Valid DmsPrintRenderRequest request) { return ResponseEntity.ok() .contentType(MediaType.APPLICATION_PDF) .cacheControl(CacheControl.noStore()) .body(service.render(request, UserProvider.getUser())); } }