Printing HTML or ASP.NET Page

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

    Printing HTML or ASP.NET Page

    Hi,

    I have an html page and I might be moving to asp.net page that contains a
    some kind of forum and string.

    It is kind of application form. User have to enter some (string) value into
    the forum which forum actualy similar to small article.

    Then user have to use PRINT button to print the page. My problem is that
    when I try to print it prints the HTML Name on top left as well as the page
    number on top right. Plus it is also prints the page link on Left side of the
    bottom of the page.

    I do not want to print the HTML page title, page number and the page link.
    Does anyone knows good article or at this small example that shows how to
    over come from this problem.

    I thank you for your kind understanding to reading my mail for your future
    help.

    Rgds,
    GC
  • interwanderer

    #2
    RE: Printing HTML or ASP.NET Page


    hello,

    these details are added in the browser preferences...
    (File => page setup)
    and you can't change it with regular web scripting unfortunately.

    you can buy a third party activex object though to aid you with this problem.
    for example:
    Whether you're new to ScriptX or in the process of migrating an existing ScriptX.Add-on application to ScriptX.Services these guides will get you started.


    interwanderer




    "Niyazi" wrote:
    [color=blue]
    > Hi,
    >
    > I have an html page and I might be moving to asp.net page that contains a
    > some kind of forum and string.
    >
    > It is kind of application form. User have to enter some (string) value into
    > the forum which forum actualy similar to small article.
    >
    > Then user have to use PRINT button to print the page. My problem is that
    > when I try to print it prints the HTML Name on top left as well as the page
    > number on top right. Plus it is also prints the page link on Left side of the
    > bottom of the page.
    >
    > I do not want to print the HTML page title, page number and the page link.
    > Does anyone knows good article or at this small example that shows how to
    > over come from this problem.
    >
    > I thank you for your kind understanding to reading my mail for your future
    > help.
    >
    > Rgds,
    > GC[/color]

    Comment

    • Niyazi

      #3
      RE: Printing HTML or ASP.NET Page

      Hi interwanderer,

      I don't have that much money to buy the third party ActiveX object. I see
      the link before but as I wrote above money is the problem.

      I also find this small script:
      -----------------------------------------------------------------------------------------------
      <script type="text/vbscript">
      Dim WSHShell
      Set WSHShell = CreateObject("W Script.Shell")
      myHeader = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
      Explorer\PageSe tup\header")
      myFooter = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
      Explorer\PageSe tup\footer")

      WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
      Explorer\PageSe tup\header", ""
      WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
      Explorer\PageSe tup\footer", ""

      Sub ResetHeader()
      Dim WSHShell
      Set WSHShell = CreateObject("W Script.Shell")

      WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
      Explorer\PageSe tup\header", myHeader
      WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
      Explorer\PageSe tup\footer", myFooter
      End Sub
      </script>
      -----------------------------------------------------------------------------------------------

      I place the script end of the </head> tag and above the body tag. I am
      trying to show where I placed it in above line:

      ------------------------------------------------------------------------------------------------

      <head>
      .....
      .....
      .....

      above script

      </head>

      <body lang=EN-US style='tab-interval:.5in'>
      ....
      .....
      .....


      ----------------------------------------------------------------------------------------------

      But when I try to click print button it doesn't print. I allow the code to
      run due to security bar that appears on top of the page but still no printing
      and and the bottom of the tray icon area my printer shows some error.

      Do you know how to use the above script to run the page and when user press
      the PRINT button that it will print without the header and footer information.

      Thank you very much for kind understanding.

      Rgds,
      GC

      Comment

      • John Timney \( MVP \)

        #4
        Re: Printing HTML or ASP.NET Page

        have tyou looked at css print style sheets

        Say no to “printer-friendly” versions and yes to printer-specific style sheets. CSS expert Eric Meyer shows how to conceive and design print style sheets that automatically format web c…


        --
        Regards

        John Timney
        ASP.NET MVP
        Microsoft Regional Director

        "Niyazi" <Niyazi@discuss ions.microsoft. com> wrote in message
        news:60C7282C-7EFB-43BA-A3D0-924EF9EABD01@mi crosoft.com...[color=blue]
        > Hi,
        >
        > I have an html page and I might be moving to asp.net page that contains a
        > some kind of forum and string.
        >
        > It is kind of application form. User have to enter some (string) value
        > into
        > the forum which forum actualy similar to small article.
        >
        > Then user have to use PRINT button to print the page. My problem is that
        > when I try to print it prints the HTML Name on top left as well as the
        > page
        > number on top right. Plus it is also prints the page link on Left side of
        > the
        > bottom of the page.
        >
        > I do not want to print the HTML page title, page number and the page link.
        > Does anyone knows good article or at this small example that shows how to
        > over come from this problem.
        >
        > I thank you for your kind understanding to reading my mail for your future
        > help.
        >
        > Rgds,
        > GC[/color]


        Comment

        • Niyazi

          #5
          Re: Printing HTML or ASP.NET Page

          Hi John

          I saw the article before. But I dont know how to use the CSS. And I am not
          familar with html or ASP.NET.

          I was created big windows base client server application and I am only
          programmer and my boss keep giving me new assignment.

          As I wrote before we have 15 forms that user must fill few text boxes and
          print irt like word pages. My boss want to put all the 15 forum into intranet
          so user can fill the forum and then they must print the forum that our
          coustemer can sign in signature area.

          I try last night the deletring header and footer section via code that I
          posted before
          and it worked well. But when I printed I can see the square that was the
          text boxes.

          The CSS might be good to over come this difficulties but I haven't used it
          before.
          Now my major problem is how to disable the visibility of the text boxe
          squares.

          I thank you for your kind comment on my problem. I will try to study the CSS
          article that you posted the link but I guess it must be very good to me if I
          can find live demo or example that shows clearly how to Print HTML with CSS.

          Thank you.

          Rgds,
          GC

          Comment

          • Niyazi

            #6
            Re: Printing HTML or ASP.NET Page

            Hi all

            I have follwing VBScript inside my html <head> tag:

            -----------------------------------------------------------------------------------------------
            <script type="text/vbscript">

            // PRINT BUTTON ACTIVATED
            Sub PrintMe()
            Dim WSHShell
            Set WSHShell = CreateObject("W Script.Shell")

            //GET SECURITY
            MySecurity = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\Securi ty\P3Global\Ena ble")

            //GET HEADER and FOOTER INFORMATION
            myHeader = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\PageSe tup\header")
            myFooter = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\PageSe tup\footer")

            //GET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
            size, paper source}
            myMargin_Bottom = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\PageSe tup\margin_bott om")
            myMargin_Top = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\PageSe tup\margin_top" )
            myMargin_Left = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\PageSe tup\margin_left ")
            myMargin_Right = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
            Explorer\PageSe tup\margin_righ t")


            // SET SECURITY TO LOW
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\Securi ty\P3Global\Ena ble", "0"

            //SET HEADER and FOOTER INFORMATION
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\header", ""
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\footer", ""

            //SET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
            size, paper source}
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_bott om", "0.05"
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_top" , "0.5"
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_left ", "0.3"
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_righ t", "0.05"

            window.print();

            // CLEAR THE TEXT BOXES
            txt1.value = ""
            txt2.value = ""
            txt3.value = ""
            txt4.value = ""
            txt5.value = ""
            txt6.value = ""
            txt7.value = ""

            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\Securi ty\P3Global\Ena ble", "1"

            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\header", myHeader
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\footer", myFooter

            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_bott om", myMargin_Bottom
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_top" , myMargin_Top
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_left ", myMargin_Left
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_righ t", myMargin_Right
            End Sub



            //CANCEL BUTTON ACTIVATED
            Sub ResetHeader()
            // CLEAR THE TEXT BOXES
            txt1.value = ""
            txt2.value = ""
            txt3.value = ""
            txt4.value = ""
            txt5.value = ""
            txt6.value = ""
            txt7.value = ""

            Dim WSHShell
            Set WSHShell = CreateObject("W Script.Shell")

            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\Securi ty\P3Global\Ena ble", "1"

            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\header", myHeader
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\footer", myFooter

            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_bott om", myMargin_Bottom
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_top" , myMargin_Top
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_left ", myMargin_Left
            WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
            Explorer\PageSe tup\margin_righ t", myMargin_Right

            End Sub
            </script>
            -----------------------------------------------------------------------------------------------

            And in my Rset and Print button has this code:

            <input name="Reset" type="reset" id="Reset" value="Reset"
            onClick="ResetH eader()">

            <input name="Print" type="submit" id="Print" value="Print"
            onclick="PrintM e()">

            But It doesnot Print nor Reset the html page. In html page I have few
            textBoxes and there are no form object.

            The error are:
            - Type Mismatch PrintMe()
            - Type Mismatch ResetHeader()

            Does anyone knows how to over come from this problem?

            I thank you in advance for your future help.

            Rgds,
            GC

            Comment

            Working...