I have a requirement to open a PDF document (to open an existing pdf on server not creating) with showing the appropriate section which user clicked and also need to update the count in database.
In order to do this i have followed these steps:
Ex: Lets say XYZ.pdf file which has a, b and c sections. To show section a in the URL it is some thing like ../../XYZ.pdf#a
1. First, i called my controller class when user clicks the link (to update the count in database) and in controller i used Spring MVC redirect function to open XYZ.pdf#a. But the problem is its removing the # from URL and showing entire XYZ.pdf opening first page instead of showing #a section. That too this is happening in IE browser not in Firefox.
2. I have tried another way by calling a dummy jsp from controller and onload of that jsp i did location.href function to show the pdf document. It worked but the problem is with back button, if i use POST method back button displays page cannot be displayed message, if use GET method back is not working i will be in same page forever it wont allow you to go back.
I hope i cleared explained my problem, Could any one please help me.
Thanks in advance!
- Vamshidhar Nimbagiri
Joined: Oct 04, 2004
After trying many alternative solutions. At last i found one which is working.
In my controller i setting the location to response header like this:
response.setHeader("Location", docLoc); // where docLoc is the absolute path of the location of the document.