472,799 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 software developers and data experts.

ASP.NET Server Side Printing


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
Aug 3 '06 #1
4 5834
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
Aug 3 '06 #2
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
Aug 3 '06 #3

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
Aug 11 '06 #4

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
Aug 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stuart Woodard | last post by:
I am struggling to develop a robust mechanism for server-side printing with formatted documents. I need to produce print-spool files from the remote server-side application. This isn't...
7
by: ap | last post by:
Hi, It is a quick question... Is that impossible to print the page(Web Form .aspx file) in client side using GDI+ like PrintDocument pd = new PrintDocument(); pd.print(); As I know it is a...
3
by: Ahmad Abu-Raddad | last post by:
Hey Guys, Does anyone knows of a way to print HTML source directly to the printer (Server Side)?. I tried the PrintDocument class and the e.Graphics.DrawString and e.Graphics.DrawImage() but...
1
by: Franck | last post by:
Hello, I need to implement the following features: I need to create a document on whatever format word, pdf A simple one; few field taken from a DB. This document should be printed on a client...
1
by: sprash25 | last post by:
Hi, I am using a rich text editor (FCKEdit) on a webpage in which user can enter formatted text. The output of this control is HTML. Now on the code behind side, I need to change some of this...
3
by: eddyger | last post by:
Hi, I would like to print to a printer connected to my IIS server. I mean "I DONT WANT TO PRINT ON EVERY PRINTER IN THE WORLD". (many answers are thinking javascript printing to the user side)...
1
by: ChrisN | last post by:
I have a requirement to generate and print good-looking customised correspondence. I would like to be able to use mark-up for formatting, ie as a MS Word or HTML document. However Word...
3
by: mygroup | last post by:
Hello Folks, I have an asp.net application which requires to fill a form. Once the form is completed, it should print the final page on server side (not the client side). I tried to use...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.