Print Page Functionality

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

    Print Page Functionality

    I am looking for some code to duplicate something like on
    http://www.charmeck.org/Site-Info/Home.htm when someone prints the
    Print This Page link. This site is using MSCMS so it might be using
    something built into that, but I am looking for straight ASP.NET/C#
    code.

    I was thinking of adding comments to my page:

    <!--StartPrint-->

    Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah

    <!--EndPrint-->

    Then when someone clicks Print Page, it calls PrintPage.aspx taking the
    info from between the comments and formats and displays it.

    Any thoughts, examples, or links to examples.

    Thanks,
    Greg

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Print Page Functionality

    Greg,

    It's really kind of simple. All you have to do is set a link to
    yourself, setting a flag in the querystring. Then, in your ASP.NET page, if
    the flag is checked, you choose to leave out some of the formatting using a
    conditional statement.

    Or, if there is a consistent way that you know you can format the page
    (always use the same font, remove header elements, or something of the
    sort), you can have a page that takes the URL to format in the query string.
    That page would load the page into memory, and format the page the way you
    wish, returning the new content.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "hartbypass " <ghart@medex.co m> wrote in message
    news:1130595191 .060501.295270@ o13g2000cwo.goo glegroups.com.. .[color=blue]
    >I am looking for some code to duplicate something like on
    > http://www.charmeck.org/Site-Info/Home.htm when someone prints the
    > Print This Page link. This site is using MSCMS so it might be using
    > something built into that, but I am looking for straight ASP.NET/C#
    > code.
    >
    > I was thinking of adding comments to my page:
    >
    > <!--StartPrint-->
    >
    > Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah
    >
    > <!--EndPrint-->
    >
    > Then when someone clicks Print Page, it calls PrintPage.aspx taking the
    > info from between the comments and formats and displays it.
    >
    > Any thoughts, examples, or links to examples.
    >
    > Thanks,
    > Greg
    >[/color]


    Comment

    • Nicholas Paldino [.NET/C# MVP]

      #3
      Re: Print Page Functionality

      Greg,

      It's really kind of simple. All you have to do is set a link to
      yourself, setting a flag in the querystring. Then, in your ASP.NET page, if
      the flag is checked, you choose to leave out some of the formatting using a
      conditional statement.

      Or, if there is a consistent way that you know you can format the page
      (always use the same font, remove header elements, or something of the
      sort), you can have a page that takes the URL to format in the query string.
      That page would load the page into memory, and format the page the way you
      wish, returning the new content.

      Hope this helps.


      "hartbypass " <ghart@medex.co m> wrote in message
      news:1130595191 .060501.295270@ o13g2000cwo.goo glegroups.com.. .[color=blue]
      >I am looking for some code to duplicate something like on
      > http://www.charmeck.org/Site-Info/Home.htm when someone prints the
      > Print This Page link. This site is using MSCMS so it might be using
      > something built into that, but I am looking for straight ASP.NET/C#
      > code.
      >
      > I was thinking of adding comments to my page:
      >
      > <!--StartPrint-->
      >
      > Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah, Blah,blah,blah
      >
      > <!--EndPrint-->
      >
      > Then when someone clicks Print Page, it calls PrintPage.aspx taking the
      > info from between the comments and formats and displays it.
      >
      > Any thoughts, examples, or links to examples.
      >
      > Thanks,
      > Greg
      >[/color]



      Comment

      • hartbypass

        #4
        Re: Print Page Functionality

        Hi Nicholas,

        Would you have an example written in C#? I think the latter is what I
        would want to do. I would like to have one page that is my "Print
        Page" and pass the information I want to print to it. That way if I
        change the format or layout I only have to do it in one spot. That why
        I was thinking of trying to grab the html from the page between the
        comment block and pass that on to the print page.

        Thanks,
        Greg

        Comment

        Working...