Professional Web Applications Themes

Print rendered .aspx page to server's printer - ASP.NET General

Does anyone know how I can print a fully rendered .aspx to the server's printer? I know that, if I wanted to print to the client's printer it would be easy (ie. use javascript's window.print()). However, I need to print to the server's printer. I need to print the fully rendered .aspx page from the codebehind .aspx.cs page to the server's printer. I've tried using SHDocVw.InternetExplorer and SHDocVw.WebBrowser but I just can't seem to get it to work. Any help with this would be greatly, greatly appreciated! Thank you! Regards, Robin Dindayal, BMath Systems Developer Intellitech Innovations Inc....

  1. #1

    Default Print rendered .aspx page to server's printer

    Does anyone know how I can print a fully rendered .aspx to the
    server's printer? I know that, if I wanted to print to the client's
    printer it would be easy (ie. use javascript's window.print()).

    However, I need to print to the server's printer. I need to print the
    fully rendered .aspx page from the codebehind .aspx.cs page to the
    server's printer.

    I've tried using SHDocVw.InternetExplorer and SHDocVw.WebBrowser but I
    just can't seem to get it to work. Any help with this would be
    greatly, greatly appreciated!

    Thank you!

    Regards,
    Robin Dindayal, BMath
    Systems Developer
    Intellitech Innovations Inc.
    Robin Dindayal Guest

  2. #2

    Default Re: Print rendered .aspx page to server's printer -> ExecWB gives error message, "The object invoked has disconnected from its clients."

    This is my latest attempt at getting this to work....

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

    // Get the WITH type from the to moniker
    Type IETipo = Type.GetTypeFromProgID("InternetExplorer.Applicati on");

    // Create the NET proxy class
    Object IEX = Activator.CreateInstance(IETipo);

    // Set visible true
    IETipo.InvokeMember("Visible",
    System.Reflection.BindingFlags.SetProperty, null, IEX, new object [] {
    false });

    // Call method
    IETipo.InvokeMember("Navigate",
    System.Reflection.BindingFlags.InvokeMethod, null, IEX, new object []
    { "http://www.google.ca" });

    // Print it
    Object o = null;
    object [] args = {OLECMDID.OLECMDID_PRINT,
    OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, o, o};
    ParameterModifier[] ParamMods = new ParameterModifier [1];
    ParamMods[0] = new ParameterModifier (4); // inititialize with
    number of method parameters
    ParamMods[0][2] = true; // set the 3rd param to be an out
    param
    ParamMods[0][3] = true; // set the 4th param to be an out
    param
    IETipo.InvokeMember("ExecWB",
    System.Reflection.BindingFlags.InvokeMethod, null, IEX, args,
    ParamMods, null, null);

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

    And here is the error message that I get...

    "...
    The object invoked has disconnected from its clients.
    Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: The
    object invoked has disconnected from its clients.

    Source Error:


    Line 832: ParamMods[0][2] = true; // set the 3rd param to
    be an out param
    Line 833: ParamMods[0][3] = true; // set the 4th param to
    be an out param
    Line 834: IETipo.InvokeMember("ExecWB",
    System.Reflection.BindingFlags.InvokeMethod, null, IEX, args,
    ParamMods, null, null);
    Line 835:
    Line 836:


    Source File: c:\***.cs Line: 834

    Stack Trace:

    [COMException (0x80010108): The object invoked has disconnected from
    its clients.]
    System.RuntimeType.InvokeDispMethod(String name, BindingFlags
    invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
    Int32 culture, String[] namedParameters) +0
    System.RuntimeType.InvokeMember(String name, BindingFlags
    invokeAttr, Binder binder, Object target, Object[] args,
    ParameterModifier[] modifiers, CultureInfo culture, String[]
    namedParameters) +435
    ...."

    Again, any help would be greatly appreciated! Thanks!
    Regards,
    Robin Dindayal, BMath
    Systems Developer
    Intellitech Innovations Inc.

    [email]robinrobindindayal.com[/email] (Robin Dindayal) wrote in message news:<f4052305.0307231307.517ac64dposting.google. com>...
    > Does anyone know how I can print a fully rendered .aspx to the
    > server's printer? I know that, if I wanted to print to the client's
    > printer it would be easy (ie. use javascript's window.print()).
    >
    > However, I need to print to the server's printer. I need to print the
    > fully rendered .aspx page from the codebehind .aspx.cs page to the
    > server's printer.
    >
    > I've tried using SHDocVw.InternetExplorer and SHDocVw.WebBrowser but I
    > just can't seem to get it to work. Any help with this would be
    > greatly, greatly appreciated!
    >
    > Thank you!
    >
    > Regards,
    > Robin Dindayal, BMath
    > Systems Developer
    > Intellitech Innovations Inc.
    Robin Dindayal Guest

Similar Threads

  1. Accessing an .aspx page from server in a DMZ
    By Terry in forum ASP.NET Web Services
    Replies: 0
    Last Post: July 20th, 06:46 PM
  2. Replies: 1
    Last Post: April 29th, 02:28 PM
  3. Want to Reboot server from ASPX page
    By Terry in forum ASP.NET Security
    Replies: 4
    Last Post: May 25th, 02:23 AM
  4. Replies: 4
    Last Post: August 22nd, 08:42 AM
  5. Print Server For OS 9, OS X, and Windows with USB Printer?
    By foo in forum Mac Applications & Software
    Replies: 3
    Last Post: July 18th, 06:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139