I have some issue in downloading the pdf using range requests. I am using spring boot application to provide download service. viewer.html makes 1st request which is cancelled since service supports range request and initiates partial request which is as expected but there are no further requests from browser, Its just 2 range requests where as i am expecting it to request till whole pdf is downloaded. Is there any special header that needs to be added in response so that browser sends all request to service. When i tried https://mozilla.github.io/pdf.js/web/viewer.html?file=compressed.tracemonkey-pldi-09.pdf link and inspect networks then i am able to see 1st request getting 200 response code which is cancelled before whole pdf is downloaded and then range requests(for all ranges) are initiated which gives 206 partial content
I have used spring boot for serving pdf by following https://gist.github.com/davinkevin/b97e39d7ce89198774b4
With these 2 set up and enabling cors requests. I am able to accomplish following
-
client is recognizing that server supports range request and is cancelling main request.
-
client is initiating range requests
- added headers in response : accept-ranges, content-length, content-range, accept, etag, content-type, content-disposition, last-modified, expires, Connection,vary,via,Cache-Control and exposed all of them.
Problem faced :
- client is initiating only 2 range requests after cancelling main request and stops there
from Pdf.js viewer.html not calling all range requests
No comments:
Post a Comment