Print Preview using JavaScript onClick?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kebmo

    Print Preview using JavaScript onClick?

    The client insists on having a link or button that the user can click
    to view the printable version in the browser. I already have the css
    done for the print version, so thats not a problem. I don't want to
    create duplicate pages if I can help it (I anticipate many updates as
    the months go by, and I don't want to have to do double the work).

    I know I have seen this functionality before, but I can't seem to find
    it now. Is there existing script to open the print preview pane with an
    onClick?

    Any help is greatly appreciated.

    Kebmo

  • VK

    #2
    Re: Print Preview using JavaScript onClick?


    Kebmo wrote:[color=blue]
    > The client insists on having a link or button that the user can click
    > to view the printable version in the browser. I already have the css
    > done for the print version, so thats not a problem. I don't want to
    > create duplicate pages if I can help it (I anticipate many updates as
    > the months go by, and I don't want to have to do double the work).
    >
    > I know I have seen this functionality before, but I can't seem to find
    > it now. Is there existing script to open the print preview pane with an
    > onClick?
    >
    > Any help is greatly appreciated.
    >
    > Kebmo[/color]

    In the document <head> : (no JavaScript needed)

    <link rel="stylesheet "
    type="text/css"
    media="all"
    href="stylesCom mon.css">
    <link rel="stylesheet "
    type="text/css"
    media="screen"
    href="stylesBro wser.css">
    <link rel="stylesheet "
    type="text/css"
    media="print"
    href="stylesPri nt.css">

    Comment

    • Kebmo

      #3
      Re: Print Preview using JavaScript onClick?

      Thanks. I have this sort of setup already. When the user prints the
      page, it uses the print-only styledsheet I made for that purpose.

      What I need is to be able to click a link or button and open the Print
      Preview pane just as if I had gone to file-->print preview.

      Is this even possible?

      Comment

      • Evertjan.

        #4
        Re: Print Preview using JavaScript onClick?

        Kebmo wrote on 27 okt 2005 in comp.lang.javas cript:
        [color=blue]
        > Thanks. I have this sort of setup already. When the user prints the
        > page, it uses the print-only styledsheet I made for that purpose.
        >
        > What I need is to be able to click a link or button and open the Print
        > Preview pane just as if I had gone to file-->print preview.
        >
        > Is this even possible?[/color]

        Using serverside jscript unser ASP:

        <%@ Language=JScrip t %>
        <link rel="stylesheet "
        type="text/css"
        media="all"
        href="stylesCom mon.css">

        <link rel="stylesheet "
        type="text/css"
        media="screen"
        <% ' ASP Jscript
        if(request.quer ystring('print' )=='yes'){
        %>
        href="stylesBro wser.css"
        <%
        }else{
        %>
        href="stylesPri nt.css"
        <%
        };
        %>[color=blue]
        >[/color]

        <link rel="stylesheet "
        type="text/css"
        media="print"
        href="stylesPri nt.css">

        .......

        <a href='?print=ye s'>Print preview</a>

        --
        Evertjan.
        The Netherlands.
        (Replace all crosses with dots in my emailaddress)

        Comment

        • rf

          #5
          Re: Print Preview using JavaScript onClick?

          Kebmo wrote:
          [color=blue]
          > The client insists on having a link or button that the user can click
          > to view the printable version in the browser.[/color]

          Teach your client how to use File>Print Preview. Then she will stop wanting
          that.
          --
          Cheers
          Richard.

          Comment

          • Evertjan.

            #6
            Re: Print Preview using JavaScript onClick?

            rf wrote on 27 okt 2005 in comp.lang.javas cript:
            [color=blue]
            > Kebmo wrote:
            >[color=green]
            >> The client insists on having a link or button that the user can click
            >> to view the printable version in the browser.[/color]
            >
            > Teach your client how to use File>Print Preview. Then she will stop
            > wanting that.
            >[/color]

            Or let them use Fineprint.

            <http://www.fineprint.c om/>

            --
            Evertjan.
            The Netherlands.
            (Replace all crosses with dots in my emailaddress)

            Comment

            • D. Patterson

              #7
              Re: Print Preview using JavaScript onClick?

              Another option (the one that I use) is MeadCo's ScriptX ActiveX object.
              They also have a way to make it (and pretty much any other ActiveX object)
              work with other browsers.
              Check out http://www.meadroid.com/scriptx/about.asp
              Dave

              "Kebmo" <imagographics@ gmail.com> wrote in message
              news:1130417726 .328931.37680@g 49g2000cwa.goog legroups.com...[color=blue]
              > The client insists on having a link or button that the user can click
              > to view the printable version in the browser. I already have the css
              > done for the print version, so thats not a problem. I don't want to
              > create duplicate pages if I can help it (I anticipate many updates as
              > the months go by, and I don't want to have to do double the work).
              >
              > I know I have seen this functionality before, but I can't seem to find
              > it now. Is there existing script to open the print preview pane with an
              > onClick?
              >
              > Any help is greatly appreciated.
              >
              > Kebmo
              >
              >[/color]


              Comment

              Working...