import org.apache.commons.io.IOUtils
@GetMapping("/downloadPDF/{billingCycle}")
fun downloadPDFBill(
@PathVariable billingCycle: YearMonth,
response: HttpServletResponse
) {
response.contentType = "application/x-download"
response.characterEncoding="UTF-8"
response.setHeader("Content-Disposition", "attachment;filename=${billingCycle}-bill.pdf")
val realPath="D:\\data\\2011-12-bill.pdf"
val inputStream = FileInputStream(realPath)
val outputStream = response.outputStream
IOUtils.copy(inputStream, outputStream)
outputStream.flush()
}
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/sunyuhua_keyboard/article/details/121970747
内容来源于网络,如有侵权,请联系作者删除!