Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Print a printable version

    Hi,

    Id like to give the opertunity to send a printer friendly version of a page to the printer. I guess I should make another page or text/word/pdf/rtf-document. But then I dont know how to proceed. For example in this forum when you press the "show printable version" link it opens a .php file, but doesnt send it right away to the printer.

    Please, can anyone help me?

  • #2
    Regular Coder
    Join Date
    Jul 2005
    Location
    Halifax, Nova Scotia, Canada
    Posts
    392
    Thanks
    1
    Thanked 0 Times in 0 Posts
    First of all it is probably a good idea to make a print version of your css file. Basically what this does is it enables you to style your content differently for printers than it does for viewing the pages in a browser.

    This should get you started on making your website one of the most print-friendly in the biz.
    Once I thought I was wrong but I was mistaken.

  • #3
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, the link was very interesting, but I now see I had to put my question a bit differently:

    If anyone presses the link Id like to:
    1. Open another page (with prtinter friendly styles) in a new (popup) window
    2. Send it automatically to the printer
    3. Let the window close automatically after the document is printed

  • #4
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Hi Toegang,

    I think if you really want to do it that way, I think you'll need to use a server side language because otherwise, the browser won't display it as it should print.

    However, I agree with Tristan. I suggest that you make a separate stylesheet, (not too much effort as it would be based on your existing one), which would present to your printer, only the parts of the page that you want to print.

    Then if you need to provide a preview, you can do it without causing an annoying pop-up window because, you can use the 'print preview' button in the browser.

    hth
    Bazz

    PS. I may be wrong on this bit but, what you are trying to do involves controlling a user's PC. Otherwise, how would your page know when the page has printed.
    Last edited by bazz; 08-15-2005 at 01:52 PM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #5
    Regular Coder
    Join Date
    Nov 2004
    Location
    The Netherlands
    Posts
    551
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Unless you can't use a server scripting language the best would be to attach a print stylesheet. I have one on sites wich just display navigation, header, footer as none, etc, and there's general formatting in it (p, h[1-6], address, ul, ol, dl).

    Code:
    <script type="text/javascript">window.onload=function(window.print)</script>
    CATdude about IE6: "All your box-model are belong to us"

  • #6
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As it happens I do have the possibility of using php. Although Im still a rooky at it.

    You're right Bazz,I should refrase yet again:

    3. Let the window close automatically after the print command is given

    If I were to follow the restyle option is it to put all non printable parts in a <div class="noprint"> </div>???

  • #7
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    well your stylesheet line could read like this for the print version

    <link rel="stylesheet" href="LOCATION_of_your_cssFile" type="text/css" media="print">

    It sounds to me like you shall have a button (printer friendly veriosn), which will open a window and then when they want to print they click a button in that new window print) which will close the window and print the page.

    Personal choice, I know but, I would still do it the CSS way a printer friendly version which clicking the print button in the browser (or a javascript alternative in the page), would print out the print-styled version.

    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #8
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Also, there is no way to automatically make something print, you can make the print dialog come up, but the user stills has to say "OK" before it will go to the printer. The reasons are fairly understandable, just imagine if you could do that, ads then could automatically print themselves to your printer for example.
    OracleGuy

  • #9
    Regular Coder
    Join Date
    Jul 2005
    Location
    Halifax, Nova Scotia, Canada
    Posts
    392
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Sounds like fun to me! I personally will likely never bother with in-text links to print. I will make print stylesheets and figure that if the user can get to my page they know how to print it too.
    Once I thought I was wrong but I was mistaken.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •