Print Page Functionality

  • Thread starter Thread starter hartbypass
  • Start date Start date
H

hartbypass

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
 
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.
 
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.
 
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
 
Back
Top