• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Streaming PDF files

 
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm streaming a PDF files from my servlet to the browser. This seems to work great for my machine. Issue is that it doesn't seem to work for everyone. I dont' get an error. I just get a blank screen. It just stops loading and leaves the screen blank. Almost as though it was done but didn't quite complete. Not sure why this happens. Servlet code is below
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check wheteher acrobat reader is installed in other systems.

Sam
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually it is installed.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a fatal flaw in Netscape 4. I haven't checked to see if it's in Netscape 6 and/or Mozilla, and it may be in other browsers as well.
The problem is that when you're streaming, you presumably don't yet know the content-length, and without a valid (and accurate!) content-length, Netscape 4 comes up blank. The plugin's rejecting the data.
The usual work-arounds are to either 1) buffer the document until you can get its length, then output the content-length header followd by the PDF; or 2) inform the user to save the document as a file (Content-Disposition header helps) and open the file.
Bummer, nyet?
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I found the issue. It was that I had some users using Adobe Acrobat 4. Adobe Acrobat 5 works great though. Now the new issue is how can I speed up this dispatching. Right now it takes a good amount of time to dispatch a pdf using this code. Any hints on how to speed this up?
 
Tim Holloway
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting about Acrobat 5. Although that only helps if you have an audience you KNOW has upgraded!
You should see a significant improvement in performance if you read and write in larger chunks:
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also addressed here. Please don't duplicate questions in different forums - it just causes us to duplicate our answers.
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jim. You're right. Next time I'll only post once.
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim Holloway
Can you explain a bit about this PrintSummary class. Is this going to be dispatching the temp file after its been created? Is this a class you created or did I miss this in the API?
[ August 09, 2002: Message edited by: Dale DeMott ]
 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, [Looking at Tim's code], do I need to worry about these temp files being created on the server. Will other people run into them if we get a lot of people on the server??
-Dale
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic