Set filename of the Pdf that is streamed back to the browser

后端 未结 6 929
太阳男子
太阳男子 2021-02-06 03:01

I have a Java webapp creating a pdf and streaming it back to the browser.

 byte[] pdf = report.exportPdfToArray(user);
response.setContentType(\"application/pdf         


        
6条回答
  •  心在旅途
    2021-02-06 03:23

    There is workaround to do so. We can use iframe where iframe will open in html page, iframe will hold the pdf report whereas the html page is independent of iframe. We can edit the title of html page that holds iframe.

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    
        
            ${reportName}
        
        
             
        
    
    

提交回复
热议问题