Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Print a message after every page-break when printing aspx page

Posted on 2013-11-19
1
Medium Priority
?
498 Views
Last Modified: 2013-11-22
Hello,

When using IE, I can print my web page doing right click on page and selecting Print.

How could I print a message or image after every page-break when printing my aspx page directly to printer?

I know I can produce a page-break after each H2 on the page doing this:

<HEAD>
       <STYLE TYPE="text/css">
           H2 {page-break-before: always}
      </STYLE>
</HEAD>

But how can I print a message or jpg image after a page-break was done?
0
Comment
Question by:miyahira
1 Comment
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 39659437
you'd have to use javascript for this:

<script language="javascript" type="text/javascript">
    function CallPrint(strid) {
        var prtContent = document.getElementById(strid);
        var WinPrint = window.open('', '', 'letf=0,top=0,width=800,height=100,toolbar=0,scrollbars=0,status=0,dir=ltr');
        WinPrint.document.write(prtContent.innerHTML);
        WinPrint.document.close();
        WinPrint.focus();
        WinPrint.print();
        WinPrint.close();
        prtContent.innerHTML = strOldOne;
    }
</script>

Open in new window


this code will put the section in a popup and allow you to print from there.

of course, you also create a print style sheet in CSS, hide the elements you don't want to print, and have a class (for example, named print) applied to all of the controls on your page. Therefore it would just be the need for one button.

see http://code.msdn.microsoft.com/Print-a-specific-part-of-7189b52b for more details
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question