ASP.NET Server Side Printing

Discussion in 'ASP .Net' started by =?Utf-8?B?THVjYXMgUG9uem8=?=, Aug 3, 2006.

  1. Hi All,

    I have an ASP.NET 2.0 app. The users access the pages, uniquely via pocket
    pc ...

    I need to print a page. But I need that the page print on a printer
    installed on the web server hosting my application.

    Step 1)
    The user clicks the Print icon in the web page

    Step 2)
    I'll redirect the browser to other page, designed specifically for printing
    (like a report ). Not Crystal report, but pure Web Form page.

    Step 3)
    I need that this second page, when loaded and rendered, to be printed in the
    same way if the user Selects File/Print on the client side, but print it in
    the server printer.

    Possible solutions:
    1) Get the full html of the page, after it complete the render (but how to
    do it?)
    2) Use System.Drawing.Printing ... but if I get the HTML, and print line per
    line, the report will print the HTML code, not the actual rendered page.

    How to implement this solution ?

    --
    Lucas Ponzo
    Software Engineering
    Override Software
     
    =?Utf-8?B?THVjYXMgUG9uem8=?=, Aug 3, 2006
    #1
    1. Advertising

  2. To get the full html of your page, redirect the user on the 'print' action to
    a new page that knows the referring url. Then you can use the WebRequest
    class to open a connection back to the referring URL and get the HTML and
    send that to your printing application.

    Maybe you can use COM to create an instance of the IE rendering engine on
    the server and use the print() functionality in IE to do the same thing?

    --
    Jacob W Anderson
    ---
    http://www.beyond-ordinary.com
    http://www.accessquery.com
    ---
    If you think it''s expensive to hire a professional to do the job, wait
    until you hire an amateur.



    "Lucas Ponzo" wrote:

    >
    > Hi All,
    >
    > I have an ASP.NET 2.0 app. The users access the pages, uniquely via pocket
    > pc ...
    >
    > I need to print a page. But I need that the page print on a printer
    > installed on the web server hosting my application.
    >
    > Step 1)
    > The user clicks the Print icon in the web page
    >
    > Step 2)
    > I'll redirect the browser to other page, designed specifically for printing
    > (like a report ). Not Crystal report, but pure Web Form page.
    >
    > Step 3)
    > I need that this second page, when loaded and rendered, to be printed in the
    > same way if the user Selects File/Print on the client side, but print it in
    > the server printer.
    >
    > Possible solutions:
    > 1) Get the full html of the page, after it complete the render (but how to
    > do it?)
    > 2) Use System.Drawing.Printing ... but if I get the HTML, and print line per
    > line, the report will print the HTML code, not the actual rendered page.
    >
    > How to implement this solution ?
    >
    > --
    > Lucas Ponzo
    > Software Engineering
    > Override Software
     
    =?Utf-8?B?amF2YXRvcGlh?=, Aug 3, 2006
    #2
    1. Advertising

  3. Nice !

    I can get the html and write it to a database table.

    At the server side, a program will loop this table (in a timer), save a temp
    file with
    the stored HTML and use the Navigate() mothod of the .Net WebBrowser control
    to render this HTML and use Print() method to print. Write a windows service
    may be a good solution in the case.

    I'll try this solution and update you.

    Thanks very much !

    --
    Lucas Ponzo
    Software Engineering
    Override Software


    "javatopia" wrote:

    > To get the full html of your page, redirect the user on the 'print' action to
    > a new page that knows the referring url. Then you can use the WebRequest
    > class to open a connection back to the referring URL and get the HTML and
    > send that to your printing application.
    >
    > Maybe you can use COM to create an instance of the IE rendering engine on
    > the server and use the print() functionality in IE to do the same thing?
    >
    > --
    > Jacob W Anderson
    > ---
    > http://www.beyond-ordinary.com
    > http://www.accessquery.com
    > ---
    > If you think it''s expensive to hire a professional to do the job, wait
    > until you hire an amateur.
    >
    >
    >
    > "Lucas Ponzo" wrote:
    >
    > >
    > > Hi All,
    > >
    > > I have an ASP.NET 2.0 app. The users access the pages, uniquely via pocket
    > > pc ...
    > >
    > > I need to print a page. But I need that the page print on a printer
    > > installed on the web server hosting my application.
    > >
    > > Step 1)
    > > The user clicks the Print icon in the web page
    > >
    > > Step 2)
    > > I'll redirect the browser to other page, designed specifically for printing
    > > (like a report ). Not Crystal report, but pure Web Form page.
    > >
    > > Step 3)
    > > I need that this second page, when loaded and rendered, to be printed in the
    > > same way if the user Selects File/Print on the client side, but print it in
    > > the server printer.
    > >
    > > Possible solutions:
    > > 1) Get the full html of the page, after it complete the render (but how to
    > > do it?)
    > > 2) Use System.Drawing.Printing ... but if I get the HTML, and print line per
    > > line, the report will print the HTML code, not the actual rendered page.
    > >
    > > How to implement this solution ?
    > >
    > > --
    > > Lucas Ponzo
    > > Software Engineering
    > > Override Software
     
    =?Utf-8?B?THVjYXMgUG9uem8=?=, Aug 3, 2006
    #3
  4. I use the WebRequest as following:

    WebRequest reportRequest = WebRequest.Create(reportUrl);
    WebResponse reportResponse = reportRequest.GetResponse();
    StreamReader reportReader = new StreamReader
    (reportResponse.GetResponseStream());
    string html = reportReader.ReadToEnd();

    But the reportUrl .ASPX page doesn't recognize the Session variable I
    created.
    Why ? ASP.NET creates another session for this request ?

    How do I code to the WebRequested page recognizes the session variable like
    in the same http session context ?

    This issue It's broked my ASP.NET Server side printing ...

    Passing parameters via URL are to hard because the object in the session
    variable are complexed configured and was the ideal solution that the page
    processed via WebRequest.GetResponse doesn't return a NULL value, like in
    anothe user session.

    What is the solution for that session sharing ?

    Serialization can be a good solution ?


    --
    Lucas Ponzo
    Software Engineering
    Override Software


    "javatopia" wrote:

    > To get the full html of your page, redirect the user on the 'print' action to
    > a new page that knows the referring url. Then you can use the WebRequest
    > class to open a connection back to the referring URL and get the HTML and
    > send that to your printing application.
    >
    > Maybe you can use COM to create an instance of the IE rendering engine on
    > the server and use the print() functionality in IE to do the same thing?
    >
    > --
    > Jacob W Anderson
    > ---
    > http://www.beyond-ordinary.com
    > http://www.accessquery.com
    > ---
    > If you think it''s expensive to hire a professional to do the job, wait
    > until you hire an amateur.
    >
    >
    >
    > "Lucas Ponzo" wrote:
    >
    > >
    > > Hi All,
    > >
    > > I have an ASP.NET 2.0 app. The users access the pages, uniquely via pocket
    > > pc ...
    > >
    > > I need to print a page. But I need that the page print on a printer
    > > installed on the web server hosting my application.
    > >
    > > Step 1)
    > > The user clicks the Print icon in the web page
    > >
    > > Step 2)
    > > I'll redirect the browser to other page, designed specifically for printing
    > > (like a report ). Not Crystal report, but pure Web Form page.
    > >
    > > Step 3)
    > > I need that this second page, when loaded and rendered, to be printed in the
    > > same way if the user Selects File/Print on the client side, but print it in
    > > the server printer.
    > >
    > > Possible solutions:
    > > 1) Get the full html of the page, after it complete the render (but how to
    > > do it?)
    > > 2) Use System.Drawing.Printing ... but if I get the HTML, and print line per
    > > line, the report will print the HTML code, not the actual rendered page.
    > >
    > > How to implement this solution ?
    > >
    > > --
    > > Lucas Ponzo
    > > Software Engineering
    > > Override Software
     
    =?Utf-8?B?THVjYXMgUG9uem8=?=, Aug 11, 2006
    #4
  5. I used XML serialization and deserealization and all works fine ...
    --
    Lucas Ponzo
    Software Engineering
    Override Software


    "Lucas Ponzo" wrote:

    >
    > I use the WebRequest as following:
    >
    > WebRequest reportRequest = WebRequest.Create(reportUrl);
    > WebResponse reportResponse = reportRequest.GetResponse();
    > StreamReader reportReader = new StreamReader
    > (reportResponse.GetResponseStream());
    > string html = reportReader.ReadToEnd();
    >
    > But the reportUrl .ASPX page doesn't recognize the Session variable I
    > created.
    > Why ? ASP.NET creates another session for this request ?
    >
    > How do I code to the WebRequested page recognizes the session variable like
    > in the same http session context ?
    >
    > This issue It's broked my ASP.NET Server side printing ...
    >
    > Passing parameters via URL are to hard because the object in the session
    > variable are complexed configured and was the ideal solution that the page
    > processed via WebRequest.GetResponse doesn't return a NULL value, like in
    > anothe user session.
    >
    > What is the solution for that session sharing ?
    >
    > Serialization can be a good solution ?
    >
    >
    > --
    > Lucas Ponzo
    > Software Engineering
    > Override Software
    >
    >
    > "javatopia" wrote:
    >
    > > To get the full html of your page, redirect the user on the 'print' action to
    > > a new page that knows the referring url. Then you can use the WebRequest
    > > class to open a connection back to the referring URL and get the HTML and
    > > send that to your printing application.
    > >
    > > Maybe you can use COM to create an instance of the IE rendering engine on
    > > the server and use the print() functionality in IE to do the same thing?
    > >
    > > --
    > > Jacob W Anderson
    > > ---
    > > http://www.beyond-ordinary.com
    > > http://www.accessquery.com
    > > ---
    > > If you think it''s expensive to hire a professional to do the job, wait
    > > until you hire an amateur.
    > >
    > >
    > >
    > > "Lucas Ponzo" wrote:
    > >
    > > >
    > > > Hi All,
    > > >
    > > > I have an ASP.NET 2.0 app. The users access the pages, uniquely via pocket
    > > > pc ...
    > > >
    > > > I need to print a page. But I need that the page print on a printer
    > > > installed on the web server hosting my application.
    > > >
    > > > Step 1)
    > > > The user clicks the Print icon in the web page
    > > >
    > > > Step 2)
    > > > I'll redirect the browser to other page, designed specifically for printing
    > > > (like a report ). Not Crystal report, but pure Web Form page.
    > > >
    > > > Step 3)
    > > > I need that this second page, when loaded and rendered, to be printed in the
    > > > same way if the user Selects File/Print on the client side, but print it in
    > > > the server printer.
    > > >
    > > > Possible solutions:
    > > > 1) Get the full html of the page, after it complete the render (but how to
    > > > do it?)
    > > > 2) Use System.Drawing.Printing ... but if I get the HTML, and print line per
    > > > line, the report will print the HTML code, not the actual rendered page.
    > > >
    > > > How to implement this solution ?
    > > >
    > > > --
    > > > Lucas Ponzo
    > > > Software Engineering
    > > > Override Software
     
    =?Utf-8?B?THVjYXMgUG9uem8=?=, Aug 18, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ap
    Replies:
    7
    Views:
    32,988
  2. =?Utf-8?B?TWFuaXNoIEphZGhhdg==?=

    Server side PDF printing in ASP.NET [ Manish Jadhav ]

    =?Utf-8?B?TWFuaXNoIEphZGhhdg==?=, May 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    535
    =?Utf-8?B?TWFuaXNoIEphZGhhdg==?=
    May 14, 2004
  3. edx
    Replies:
    2
    Views:
    2,755
  4. redraven
    Replies:
    0
    Views:
    887
    redraven
    Sep 21, 2004
  5. redraven

    Server-side printing from ASP.NET and MS Word

    redraven, Sep 22, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    209
    redraven
    Sep 22, 2004
Loading...

Share This Page