Print rendered .aspx page to server's printer

Ask a Question related to ASP.NET General, Design and Development.

  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. Similar Questions and Discussions

    1. page numbers rendered differently in 2000 and XP
      I have a datagrid set up working correctly with custom paging of numeri values. I tested it in WIndows XP and the page numbers are rendere nicely...
    2. Accessing a aspx page using HttpWebRequest from another aspx page on the same webapp
      Did you have any luck on this as I have the same problem. Maybe you can help me out of you solved your problem.
    3. Loading a rendered PHP page into flash?
      Please don't crosspost - pick the best forum for the question and stick with it, otherwise you get people wasting time answering questions that have...
    4. Alter Rendered HTML for page
      I'm trying to implement XHTML standards in my ASP.NET web pages but whenever I use web controls I get problems because of the very strict nature of...
    5. how to interact client script within aspx page to other page functions, etc.? PLEASE!!!
      Hi, I've spent all day trying to find some info on this...please help! I have an aspx page with an xmlDocument (not dataset/relational db) with...
  3. #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]robin@robindindayal.com[/email] (Robin Dindayal) wrote in message news:<f4052305.0307231307.517ac64d@posting.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

Posting Permissions

  • You may not post new threads
  • You may 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