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

Report/jasperserver: pdf filename


horvatj

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Yes, I call the report like this:

http://www.myserver.com:8080/jasperserver/flow.html?_flowId=viewReportFlow&reportUnit=/reports/customer1/report1&ParentFolderUri=/reports/customer1&output=pdf&j_username=reportuser&j_password=mpf&report_locale=de_AT&PK=258&LOGO=no

And this always gives a report1.pdf back to the browser. Is there a way to change this by passing a parameter to jasperserver?

 

Best regards,

Johann

Link to comment
Share on other sites

  • 2 weeks later...

swood,

 

Sorry, I can't agree with this:

The file sent from jasperserver has nothing to do with an acrobat. Even if you use a text based browser like lynx, which does not make use of any acrobat plugins, you will get a pdf file named like the report is named.

 

So this is definately set inside the jasperserver code. Last year I wrote java code like this:

if(parameterRequest.contains("pdf")){
            byte[] pdfFile=getReportPdf(reportFile.toString(),parameters);
            if(pdfFile!=null&&pdfFile.length>0){
                resp.setContentType("application/pdf");
                resp.setContentLength(pdfFile.length);
                resp.setHeader("Content-Disposition","attachment;filename=""
                        +parameterFilename+".pdf"");
                ServletOutputStream ouputStream=resp.getOutputStream();
                ouputStream.write(pdfFile,0,pdfFile.length);
                ouputStream.flush();
                ouputStream.close();
            }
        }
My simple Servlet ran inside a tomcat and you had to pass an parameter to it to assign the filename...

 

I can't believe that there is no way to set the filename of the pdf file stream sent to the browser...

And I think that this should be a common problem, no? Or do you always store your downloaded reports just with the reportname.pdf?

 

Best regards

Johann

Link to comment
Share on other sites

horvatj
Wrote:

I can't believe that there is no way to set the filename of the pdf file stream sent to the browser...

And I think that this should be a common problem, no? Or do you always store your downloaded reports just with the reportname.pdf?

No, there is no way to specify an arbitrary name for the PDF.  This might not be a very common request, since it's the first time I hear about it.

In any case, log a feature request for this.

Regards,

Lucian

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...