• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a pdf file from a URL in an applet

 
Pol Williams
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to figure out why this particular snippet of code isn't working for me. I've got an applet which is supposed to read a .pdf and display it with a pdf-renderer library, but for some reason when I read in the .pdf files which sit on my server, they end up as being corrupt. I've tested it by writing the files back out again.

I've tried viewing the applet in both IE and Firefox and the corrupt files occur. Funny thing is, when I trying viewing the applet in Safari (for Windows), the file is actually fine! I understand the JVM might be different, but I am still lost. I've compiled in Java 1.5. JVMs are 1.6. The snippet which reads the file is below.



For some reason both IE and Mozilla consistently read just a portion of the file (18kb of a 59kb file according to a sum of the len variable), and then decides its the end of the file, while Safari reads all 59kb. It honestly doesn't make sense to me, but I haven't been working with Java that long.

Any ideas as to why different browsers would handle this bit of code differently? Any other options I can try? Different methods perhaps? I'm quite stumped by this. I appreciate any help you can give me.
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the applet code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!