我對PDF base64字符串有疑問,我不知道爲什麼文件名不出現在PDF查看器中,而不是文件名我有一組我認爲與字符串有關的字符字節數組。PDF base64 string文件名
服務器端
@RequestMapping(value = "/report", produces = "application/pdf")
public @ResponseBody HttpEntity<byte[]> reportPdf(HttpServletRequest request, HttpServletResponse response)
...
byte[] document = report.getBytes(StandardCharsets.UTF_8);
...
HttpHeaders header = new HttpHeaders();
header.setContentType(new MediaType("application", "pdf"));
header.set("Content-Disposition", "inline; filename=asdfasdfasdf.pdf");
header.setContentLength(document.length);
return new HttpEntity<byte[]>(document,header);
I'm調用這個REST服務throught JavaScript的應用程序,我不知道我能做些什麼來控制這個文件名。
誰能給我任何線索?在這種情況下,可以改變這個新的文件名嗎?
問候!
它不工作,你知道如果標題信息包含在數據URI內嗎? –