print customised footer on every page on client machine while printing
-
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
-
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
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 )
-
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 )
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