vue前端+element
<el-dialog
custom-class="pdfChargeClass"
:visible.sync="pdfVisible"
width="900px">
<template>
<iframe class="prism-player" :src="pdfUrl" width="100%" height="800px"></iframe>
</template>
</el-dialog>
springboot后端
/**
* 文件预览
* @param response
* @throws IOException
*/
@GetMapping("/previewPdf")
@ResponseBody
public void previewPdf(String fileId, HttpServletResponse response) throws IOException {
// "D:\\tmp\\1519559233116921858.pdf"
InputStream in = null;
OutputStream out = response.getOutputStream();
try {
File file = new File("D:\\tmp\\1519559233116921858.pdf");
if (file.exists()){
response.res