Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Streaming PDF files  RSS feed

 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • 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
 
Mathew Sam
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Actually it is installed.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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:
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!