473,854 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
+ 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 5905
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.Crea te(reportUrl);
WebResponse reportResponse = reportRequest.G etResponse();
StreamReader reportReader = new StreamReader
(reportResponse .GetResponseStr eam());
string html = reportReader.Re adToEnd();

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.GetR esponse 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.Crea te(reportUrl);
WebResponse reportResponse = reportRequest.G etResponse();
StreamReader reportReader = new StreamReader
(reportResponse .GetResponseStr eam());
string html = reportReader.Re adToEnd();

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.GetR esponse 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
1325
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 straightforward with PrintDocument, so I have had to create a new class that uses Windows calls from within the PrintPage event. That solved the spool file problem, but I have since been having trouble with formatted text. To use PrintPage events, I...
7
8439
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 server side printing... and is that possible to make it to client side printing or it must be printed using javascript??
3
2416
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 these does not take HTML. If anyone can help please do.
1
1169
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 specified printer (on intranet) and may not be stored. I thought about going on to crystal report but it seems sort of complicated as I start from scratch I also thought about generate de file on a server directory,
1
1679
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 HTML and then print the HTML (the pretty document - not the code) on the server printer. Any ideas??
3
2369
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) I just want to print on the server side only for me (in ASP of course) Another thing to consider is that i use a local printer that generate PDF (Acrobat Distiller driver + ghostscript + redmon port redirector ). My server side printer name is...
1
1572
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 doesn't seem to be an option because of various problems including print dialog boxes and licensing. Is there an engine that will render HTML and print it? I can't
3
2393
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 SHDocVw.InternetExplorer object. It opens up the window but it is hidden(even if it I make visible property to True). If I given print command, it does nothing. Here is my code. I have added reference of Interop.SHDocVw.dll Imports System.Threading
0
9751
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10678
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9512
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7914
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4557
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 we have to send another system
2
4153
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.