首页>代码>SpringBoot Html转PDF SpringBoot转换网页为PDF>/springboot-pdf-master/src/main/java/com/example/demo/controller/PdfController.java
package com.example.demo.controller; import com.example.demo.model.PdfFileRequest; import com.example.demo.service.PdfFileCreator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; /** * @author Simon */ @RestController public class PdfController { private final PdfFileCreator pdfFileCreator; @Autowired public PdfController(PdfFileCreator pdfFileCreator) { this.pdfFileCreator = pdfFileCreator; } @RequestMapping(value = "/api/pdf", method = RequestMethod.POST) public void createPdf(@RequestBody PdfFileRequest fileRequest, HttpServletResponse response) { pdfFileCreator.writePdfToResponse(fileRequest, response); } }


citybird LV4
2024年11月20日
develop LV10
2024年6月2日
f22m1a2b2 LV17
2024年5月31日
taoshen95 LV16
2024年5月15日
2716804680 LV9
2024年4月20日
2317696509 LV6
2023年12月15日
chenlie LV2
2023年11月13日
内心向阳 LV4
2023年11月7日
13043860zj LV16
2023年10月31日
pizizhang
2023年10月20日
暂无贡献等级