In my controller I want to open a pdf and stream it to the browser. This code works fine if I don’t use the open parameters. However, I need to use an open parameter like #search=”java” after the filename. Using open parameters works fine if it is a url but is there a way that I can use adobe open parameters to open the file.
Code that I am using is:
private static final String DOCUMENT_LOCATION = "C:\\testPDF\\mytest.pdf#search=" + "\"" + "java" + "\"";
@RequestMapping(method=RequestMethod.GET)
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// set some response headers
response.setContentType("application/pdf");
InputStream in = new FileInputStream(DOCUMENT_LOCATION);
OutputStream out = response.getOutputStream();
// Copy the bits from instream to outstream
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
}
well it turns out that adobe no longer supports open parameters, so what I ended up doing was passing the search url parameter which opens the search function in Adobe automatically. Unfortunatley this does not work in Firefox only in IE.