469,289 Members | 2,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

Need help with changing javascript for download pdf

This is the current script for a print this page function:
<span class='print'><a href='javascript:window.print()' class='first'>PRINT THIS PAGE</a></span>\

I want to be able to change it to "DOWNLOAD PDF".

I have created all my pdfs of each page (instead of print page, I saved each page as a pdf)

I want to be able to download each individual page on a site but do not know how to change the main .js file to do that. Can someone advise?
Nov 27 '07 #1
5 1165
JosAH
11,448 Expert 8TB
You do realize that this is a Java Forum, not a Javascript Forum do you? Also
realize that Java (or JSPs) are evaluated/executed on the server side while
Javascript is executed in your browser on the client side.

Do you want me to move your question over to the Javascript Forum?

kind regards,

Jos
Nov 27 '07 #2
My apologies! I am new at this. If you can move this, that would be very great! thank you.



You do realize that this is a Java Forum, not a Javascript Forum do you? Also
realize that Java (or JSPs) are evaluated/executed on the server side while
Javascript is executed in your browser on the client side.

Do you want me to move your question over to the Javascript Forum?

kind regards,

Jos
Nov 27 '07 #3
acoder
16,027 Expert Mod 8TB
This is the current script for a print this page function:
<span class='print'><a href='javascript:window.print()' class='first'>PRINT THIS PAGE</a></span>\

I want to be able to change it to "DOWNLOAD PDF".

I have created all my pdfs of each page (instead of print page, I saved each page as a pdf)

I want to be able to download each individual page on a site but do not know how to change the main .js file to do that. Can someone advise?
Change the hrefs to point to the PDFs.

As for the text, you could just modify it yourself unless you need to do it dynamically.

Can you post your code?
Nov 27 '07 #4
Hi. this is the code:

Expand|Select|Wrap|Line Numbers
  1. $(function(){
  2.  
  3.     // print return contact copy
  4.     // FOOTER 
  5.     footer = "<div class='footer'>\
  6.     <span class='print'><a href='javascript:window.print()' class='first'>PRINT PAGE</a></span>\
  7.     <span class='top'>|<a href='#'>RETURN TO TOP</a></span>\
  8.     <span class='contact'>|<a href='contact.htm'>CONTACT</a></span>\
  9.     <span class='copy' >|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &copy; 2007 CO NAME.</span>\
  10.     </div>"
  11.  
  12.     $("#content").append( footer )
  13.     $(".team .top").hide()
  14.  
  15.     //$('#content').jScrollPane(  {showArrows :true, scrollbarWidth:15} );
  16.  
  17.     //MIN-HEIGHT
  18.     wh = $(window).height()
  19.     dh = $(document).height()
  20.     if ( dh <= wh ){$(".container").css("height", wh-25 + "px")/* 25 px from conntainer padding top */ }
  21.  
  22.     //left column filler
  23.     $("td.left_col").append( '<div class="filler">&nbsp;</div>' )
  24.     o=$(".filler").offset()
  25.     new_filler_height = dh - o.top
  26.     $(".filler").height( new_filler_height )
  27.     //alert("wh = "+wh+", dh = "+dh+", filler.offset = "+o.top+", calc = "+ new_filler_height )
  28.  
  29. })
Nov 27 '07 #5
acoder
16,027 Expert Mod 8TB
Is it not as simple as:
[HTML]<span class='print'><a href='the_pdf_file.pdf' class='first'>DOWNLOAD PDF</a></span>[/HTML]
Nov 28 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Rami A. Kishek | last post: by
35 posts views Thread by Boobie | last post: by
1 post views Thread by Jeff Cooper | last post: by
3 posts views Thread by moondaddy | last post: by
7 posts views Thread by MZ | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.