ASP.NET Server Side Printing

G

Guest

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 ?
 
G

Guest

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?
 
G

Guest

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 !
 
G

Guest

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 ?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top