Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

print html rendered page from asp .net server

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mygroup@vishalon.net - 20 Mar 2008 20:43 GMT
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
Try
           Dim o As Object
           Dim result As Object
           ie.Navigate("http://localhost/Default.aspx", o, o, o, o)
           ie.Visible = True
           While ie.Busy
               Thread.Sleep(300)
           End While
           ie.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, o, o)
       Catch ex As Exception
           Response.Write("<br>Error occurred<br>")
           Response.Write(ex.Message)
           'Response.Write("<br>" & ex.InnerException.ToString)
       End Try

When I run this code, no error occurs but IE window is hidden. (In
process list it shows IE) For printing, it does not do anything.
Is there anyway I can get server side printing in asp .net?

Thanks
George Ter-Saakov - 20 Mar 2008 21:46 GMT
Printers are specific to account.
So if you installed printer they will be installed only under account you
logged in with.

ASP.NET runs under different account so it simply does not have printers
available.

Google "print from NT service" to find out how to setup printers for ASP.NET
account

George.

> Hello Folks,
> I have an asp.net application which requires to fill a form. Once the
[quoted text clipped - 27 lines]
>
> Thanks
mygroup@vishalon.net - 20 Mar 2008 22:37 GMT
I have given permission to ASP .Net account to use printer but it is
not working. I can hear some sounds as if some error occurred but it
is not visible to me because IE window is not visible even if I made
Visible = True. Is there any other way around to print on server side?
bruce barker - 21 Mar 2008 01:58 GMT
services like asp.net can not access the desktop, so there is no way to show
a window. also no default printer is setup for a service as its running
without a standard profile.

-- bruce (sqlwork.com)

> I have given permission to ASP .Net account to use printer but it is
> not working. I can hear some sounds as if some error occurred but it
> is not visible to me because IE window is not visible even if I made
> Visible = True. Is there any other way around to print on server side?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.