• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Auto Open PDF file sent from server on client side

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an HTML page which has a hyperlink for opening a file. When the user clicks on the same a request is sent to the server which in response sends a pdf file. Now the PDf file that is being sent across is huge in size. So it takes a lot of time to open the file, since the file is first downloaded on the client side and then opened. Is there any work around on this? I was wondering if I would be able to open the pdf file as it is being downloaded rather than wait for it to be completely downloaded, by setting some HTTP headers.


Thanks in advance
Paddy


 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will satisfy you to use "application/octet-stream" as the content-type and "Content-Disposition" as the header.

Of course, you also need to spesify the filename which will be downloaded.

You may try above.
 
paddy Mahadeva Iyer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Its not working. It is prompting me to save the file. Anyway thanks for that suggestion.

Guys, still stuck with it, any other advice? Highly appreciated.

Thanks
Paddy
 
Han Jie
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi paddy.

That's right and of course it would prompt you that whether you are willing to download the PDF or not.

Isn't the above suggestion what you want?

What is your purpose here? Maybe you can describe your requirements again more clearly.

HanJie

 
paddy Mahadeva Iyer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, my requirement is that the pdf should not wait for a prompt from user. It should automatically open the file. Also, it should not wait for the whole Pdf to be downloaded , but should open as soon as it gets a readable chunk, then as per each chunk it should keep adding to the pdf file.

Thanks
Paddy
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the user has set the browser to ask what it should do with the file, then there's nothing the web app can do about that.

If the user has set the browser not to open PDFs, but to save them to disk right away, then there's nothing the web app can do about that, either.

Lastly, I'm unaware of a PDF viewer that works with partial files.
 
Rancher
Posts: 377
Android Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Lester Burnham wrote:Lastly, I'm unaware of a PDF viewer that works with partial files.



I have come across this before, where it will start showing the pages that are downloaded and tell you the percentage that it has downloaded. I very much doubt that there will anyway to enforce this though. It will be down to the browser settings that a user has and what plugins they are using.

Think about the security of running a file as soon as you click a link for it.
 
paddy Mahadeva Iyer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was brain storming about this issue with a few of my friends. Somebody suggested that this feature has to be set when the pdf file is being created. Can anybody confirm this?
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

paddy Mahadeva Iyer wrote:Can anybody confirm this?


No. See my previous post.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!