Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. print customised footer on every page on client machine while printing

print customised footer on every page on client machine while printing

Scheduled Pinned Locked Moved ASP.NET
helpsysadminwindows-adminquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anand Desai
    wrote on last edited by
    #1

    Hi coders, Currently I am going through a bit complicated problem. It would be great if I get help from you. The issues is, I have "print this page" button on each page on my site. Where I have called "window.print()". Now my client wants customised footer on that including his logo etc. So now, on that print button, I popup a window and pass the content to another predifed page with footer. Its working nice if only 1 page print is their, but if content is big and expands to 2 or more pages then my footer is printed on last page only (Obviously). So, I wrote a code for manipulating the Registry Key for "Microsoft\\Internet Explorer\\PageSetup". Code is below:

          string strPath = "Software\\\\Microsoft\\\\Internet Explorer\\\\PageSetup";
          Microsoft.Win32.RegistryKey oKey = null;
    
          /\* The following lines of code takes care that error does not occur if registry settings are not at proper path.\*/
          oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey (strPath, true);
          if (oKey != null)
          {
              oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(strPath, true);
          }
          else
          {
            oKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey (strPath, true);
          }
            
          string strKey = "footer";
          //object oValue = "&u&b&d"; 
          object oValue = "test footer"; 
          oKey.SetValue (strKey, oValue);
          strKey = "header";
          oValue = "&d";
          oKey.SetValue(strKey, oValue);
           /\* You can also get the value in registry by following line of code
              string strValue=oKey.GetValue (strKey).ToString();\*/
           oKey.Close();
    

    But, I think this will modify Server machine's registry value not client machine's. Is their any other way to cop-up with this issue?? Any help will be greatful. Thanks,

    Anand Desai Developer Atharva Infotech

    C 1 Reply Last reply
    0
    • A Anand Desai

      Hi coders, Currently I am going through a bit complicated problem. It would be great if I get help from you. The issues is, I have "print this page" button on each page on my site. Where I have called "window.print()". Now my client wants customised footer on that including his logo etc. So now, on that print button, I popup a window and pass the content to another predifed page with footer. Its working nice if only 1 page print is their, but if content is big and expands to 2 or more pages then my footer is printed on last page only (Obviously). So, I wrote a code for manipulating the Registry Key for "Microsoft\\Internet Explorer\\PageSetup". Code is below:

            string strPath = "Software\\\\Microsoft\\\\Internet Explorer\\\\PageSetup";
            Microsoft.Win32.RegistryKey oKey = null;
      
            /\* The following lines of code takes care that error does not occur if registry settings are not at proper path.\*/
            oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey (strPath, true);
            if (oKey != null)
            {
                oKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(strPath, true);
            }
            else
            {
              oKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey (strPath, true);
            }
              
            string strKey = "footer";
            //object oValue = "&u&b&d"; 
            object oValue = "test footer"; 
            oKey.SetValue (strKey, oValue);
            strKey = "header";
            oValue = "&d";
            oKey.SetValue(strKey, oValue);
             /\* You can also get the value in registry by following line of code
                string strValue=oKey.GetValue (strKey).ToString();\*/
             oKey.Close();
      

      But, I think this will modify Server machine's registry value not client machine's. Is their any other way to cop-up with this issue?? Any help will be greatful. Thanks,

      Anand Desai Developer Atharva Infotech

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Anand Desai wrote:

      But, I think this will modify Server machine's registry value not client machine's.

      Correct. The only solution I can see, is to know where the page breaks are, and insert the footer accordingly.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      A 1 Reply Last reply
      0
      • C Christian Graus

        Anand Desai wrote:

        But, I think this will modify Server machine's registry value not client machine's.

        Correct. The only solution I can see, is to know where the page breaks are, and insert the footer accordingly.

        Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

        A Offline
        A Offline
        Anand Desai
        wrote on last edited by
        #3

        Christian Graus wrote:

        to know where the page breaks are, and insert the footer accordingly

        Ouch!!! That will cause lot of coplexity. Specially if content have images, I have to mind image height and everything. Actually I thought of that before but for the same probelm as I mentioned, I refuse that solution. I have also thought of one other solution that is to create word/pdf document (on click event of that button) on client machine and put footer on that. but that will look very ugly.(imagine clicking Print button, one document is being downloded on client machine). Can I access client machine Registry by Javascript? I think thento It will cause permission problem to modify remote machine registry. Am I right? Thanks for suggession Christian!!

        Anand Desai Developer Atharva Infotech

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups