Surendra Sharma

Surendra Sharma

Search This Blog

Wednesday, August 28, 2013

How to open ASP.NET web page in Print mode

I have requirement where user clicked on link in Main page should open another window with view only information. This view only window should be directly open in PRINT mode as below

This can be achieve by using Javascript functions.

Below ASPX page directly opened in Print mode

<html xmlns="">
<head id="Head1" runat="server">
    <title>Open Page in Print Mode</title>

    <script type="text/javascript" src=""></script>

    <script type="text/javascript">
        $(document).ready(function() {
            //Allow page to be load so keep delay of 1 sec and show the print dialogue
            setTimeout(printWindowAfterDelay, 1000);

        function printWindowAfterDelay() {


    <form id="form1" runat="server">
            <h1 align="left">
                Open page in print mode</h1>
            Put your controls here

Please leave your comments or share this tip if it’s useful for you.

1 comment:

  1. This is so prehistoric.
    Use iTextSharp, it's free and excellent.