Jump to content
We've recently updated our Privacy Statement, available here ×

How to force browser to download pdf output


radekben27

Recommended Posts

I'm calling report from JasperReport Server via URL. parameter output is set to pdf. Generated report is opened in the same tab (Content-Disposition=application - maybe it is default). I want to download pdf file instead of (Content-Disposition=attachment). Is it possible to set in URL Content-Disposition?
Link to comment
Share on other sites

  • 4 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Add headers property in your bean

 

<bean id="myReportPDF"
        class="org.springframework.web.servlet.view.jasperreports.JasperReportsMultiFormatView"
        p:url="/WEB-INF/jrxml/tac/yourjrxml.jrxml" p:reportDataKey="datasource">
        <property name="headers">
            <props>
                <prop key="Content-Disposition">
                    attachment; filename=mypdf.pdf
                </prop>
            </props>
        </property>
    </bean>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...