Printing PDF from Process.Start( , ) without user prompt

G

Guest

The following .exe and its parameters work correctly from the command prompt
(it prints x.pdf without prompting the user.

acrord32.exe /t "c:\exportfiles\x.pdf" "HP LaserJet 3300 Series PCL 6" "HP
LaserJet 3300 Series PCL" "DOT4_001"

But, I have not been able to use the exe and its parameters as arguments #1
& #2 in System.Diagnostics.Process.Start( arg1 , arg2) when run in the code
behind of a Visual Studio WebForm

I have given ASP.NET all permissions, so commands like
System.Diagnostics.Process.Start("c:\\windows\\system32\\notepad.exe","c:\\x.txt"); work fine
 
J

Jeff Dillon

You want to run this on the Server? Do you get an error? Define "have not
been able"

Jeff
mg said:
The following .exe and its parameters work correctly from the command prompt
(it prints x.pdf without prompting the user.

acrord32.exe /t "c:\exportfiles\x.pdf" "HP LaserJet 3300 Series PCL 6" "HP
LaserJet 3300 Series PCL" "DOT4_001"

But, I have not been able to use the exe and its parameters as arguments #1
& #2 in System.Diagnostics.Process.Start( arg1 , arg2) when run in the code
behind of a Visual Studio WebForm

I have given ASP.NET all permissions, so commands like
System.Diagnostics.Process.Start("c:\\windows\\system32\\notepad.exe","c:\\x
..txt"); work fine
 
G

Guest

You want to run this on the Server?

Yes. But for now I'd be happy to get it running on my desktop using Visual
Studio .NET

Yes:
Unhandled exception at 0x65697265 in AcroRd32.exe: 0xC0000005: Access
violation reading location 0x65697265.
Define "have not been able"

The file x.pdf is not printed.
 
J

Jeff Dillon

Show the exact code that you are using, and I'll try it here.

Just so you know, clients will be printing on the server via this technique,
not from their desktop. How does the paper then get from the printer near
the server, to the client sitting at their desk?

Jeff
 
G

Guest

System.Diagnostics.Process.Start("c:\\program files\\adobe\\acrobat
6.0\\reader\\acrord32.exe",@"/t c:\exportfiles\d.pdf 'HP LaserJet 3300 Series
PCL 6' 'HP LaserJet 3300 Series PCL' 'DOT4_001'");

It doesn't. This code prints the pdf file on a printer named HP LaserJet
3300 Series PCL 6 (or any other printer name I choose)

=======================

Unless you know how to give the ASP.NET worker process the permissions
(that's a whole nother story), this code won't actually print. But, if this
code were to run without error at your site, chances are it would also print
here, where the ASP.NET worker process has the permissions it needs to do so.

It appears
 
J

Jeff Dillon

No, not any printer you choose. It must be defined within the context of the
user account running it, AND on the machine it's running from! It would
have to be listed under Printers in Control Panel on the server the ASP.NET
page is being served up from.

You can have the ASP.NET process run under any account you choose. I have
one test site running here under my admin account. As long as I specify a
pre-configured printer in your parameter list, it will print (on/from the
server, not at the client)

Jeff
 
H

Hero

I have the problem to to start an application from within a web
application too.
The application is started (I can see it in task manager) but the
window is hidden. I think the ASPNET user has not the permission to
"interact with the desktop". The only way I could start an application
on the server is to change the username attribut in <processmodel> in
machine.config to "SYSTEM".
You wrote, that you gave asp.net all permissions to start e.g.
notepad. Can you please tell me, how you did that?

Thanks, Uli
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top