473,493 Members | 4,355 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 5882
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
1309
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
8413
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
2397
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
1147
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
1661
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
2352
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
1557
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
2380
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...
0
7118
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6980
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.