4

I have a web page designed in MVC3. I want to add some data (a disclaimer text) at the bottom of the page on the print button click and then print the page. How to do this?

Thanks!

2 Answers 2

2

Description

You can do this using css.

  • Create a div at the end of your page and give them a className disclaimer
  • Create a stylesheet file for the normal view of your page and set the display attribute to none
  • Create another css file called print.css and set the display attribute to visible

Sample

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
    <head>
        <title></title>
        <link href="myCSSfile.css" rel="stylesheet" type="text/css" media="screen">
        <link href="print.css" rel="stylesheet" type="text/css" media="print">
     <head>
    <body>

        <!--- your content --->

        <div class="disclaimer">Your disclaimer text</div>
    </body>
</html>

Your myCSSfile.css

.disclaimer { display: none; }

Your print.css

.disclaimer { display: block; }

More Information

Sign up to request clarification or add additional context in comments.

Comments

0

You want to use CSS and print media style sheets to make the element visible for printing.

A basic tutorial about this can be seen here: CSS Media Types Create Print-Friendly Pages

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.