PDF Preload

Thread Solved

Join Date: Apr 2007
Posts: 1,122
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 93
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

PDF Preload

 
0
  #1
Jun 16th, 2009
I have a large pdf (>1 MB)that i want to preload on a html page that says "Please wait..." and display that at the middle of the screen.. so that users know that the pdf is loading (i know it says it at the bottom of the screen, but i'm worried they might not see that). How can i preload a pdf in an html page and then have it display?

or how to embed a pdf file using html or any language? thank you for any ideas.
TRY MY SUGGESTIONS AT YOUR OWN RISK
Do other alternative first..cheap and easy ways..
Don't take out money from your pocket when you're not so sure that it will solve the problem..
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 302
Reputation: sreein1986 is an unknown quantity at this point 
Solved Threads: 33
sreein1986's Avatar
sreein1986 sreein1986 is offline Offline
Posting Whiz

Re: PDF Preload

 
0
  #2
Jun 16th, 2009
it is possible with JavaScript not possible in HTML, post this in JavaScript forum
Thanx,
Shiriyal

http://shiriyal.blogspot.com/
if you problem solved add me as a reputation and mark it mark as solved
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 9
Reputation: silviubogan is an unknown quantity at this point 
Solved Threads: 1
silviubogan's Avatar
silviubogan silviubogan is offline Offline
Newbie Poster

Re: PDF Preload

 
0
  #3
Jun 16th, 2009
Put this in the head tag of your webpage:
HTML and CSS Syntax (Toggle Plain Text)
  1. <meta http-equiv="refresh" content="2;url=http://www.yourwebsite.com/pdfdoc.pdf">
Replace "2" with the number of seconds the user will wait until he will be redirected to "pdfdoc.pdf" (replace it with your pdf file's path).

You may also use a hidden iframe with the pdf file which will load while the "Loading..." text will be shown to the user. After it is loaded you can make the iframe visible using javascript.
--Silviu Bogan
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 1,122
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 93
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

Re: PDF Preload

 
0
  #4
Jun 17th, 2009
i did a search using iframe..for javascript..but there's a lot complaining that their system were injected by a malicious code because of using such method.. any comments for this?

or is there a way to detect if the file has downloaded completely? thank you.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,393
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 168
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: PDF Preload

 
0
  #5
Jun 17th, 2009
It is possible, preferable?, to actually preload the .pdf file so that the impression of instant loading is given.
in the page prior to the pdf linked page add a preload script
  1. <script language="javascript" type="text/javascript">
  2. //<![CDATA[
  3. <!--
  4. image1 = new Image();
  5. image1.src = "http://mysite.com/mypdf.pdf";
  6. //-->
  7. //]]>
  8. </script>
The code above placed between </body> and </html> in the page containing the link to the .pdf file (or html file with the .pdf in it) instructs the browser to download the pdf file to the browser cache, but just leave it there.
(filetype is irelevant image() is convenient, use the same script for any filetype as it is not ever going to be rendered)
the download happens after the page is fully rendered so does not delay the current page.
on clicking the link to the .pdf file (or html page) the browser finds the .pdf in the browser cache and does not download it, but displays from the cache, at apparently blinding download speeds.
In browsers with javascript disabled, the function degrades gracefully
Last edited by almostbob; Jun 17th, 2009 at 10:46 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 1,122
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 93
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

Re: PDF Preload

 
0
  #6
Jun 17th, 2009
thanks almostbob, i'll try it out...
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,393
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 168
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: PDF Preload

 
0
  #7
Jun 18th, 2009
hope it works for you
I use the script to load large images of the inpage thumbnails so the fullsize image changes instalntly on mouseclick
+ have some instructional .pdfs load so they open onclick
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 598 | Replies: 6
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC