2

I have a jsp page from which I'm calling a Java class. That class contains code for pdf generation.

Now when I click the button an empty jsp also displays along with the pdf. I wish that jsp page will not get open when I click the button. Only that pdf should be displayed.

This is my jsp page.I'm calling the class which uses Windchill API

<%@page import="wt.part.WTPart"%>
<%@page import="wt.fc.WTObject"%>
<%@page import="ext.gt.checkOut.New"%>
<%
    String part2="GT024";
    ext.gt.checkOut.New.pdf1(part2);
%>
Vignesh Vino
  • 1,242
  • 4
  • 25
  • 50

2 Answers2

1

Try to add
<%
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "attachment; filename=yourfilename.pdf");
%>

Alex
  • 11,451
  • 6
  • 37
  • 52
1

Got from Windchill Q&A site http://ezcollab.com/questions/93/how-to-stream-file-in-jsp

response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition","attachment;filename=\"" + fileName + "\"");       
BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(response.getOutputStream());     
Mark Noir
  • 11
  • 1