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 runnning this
line 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

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 6' + 'DOT4_001'");

BUT THIS DOESN'T WORK!
 
S

ShaneB

You're not handling the quotation marks properly. In addition, I removed
the "+" signs because they weren't in your command prompt version...which
you said works. Anyway, the line should be:


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

This is now equivalent to what you stated in your first post:

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


I recommend using a MessageBox to test code like this... That way you can
see what the strings will look after all the formatting is done.

ShaneB
 
G

Guest

Your code works! Thank you very much!



ShaneB said:
You're not handling the quotation marks properly. In addition, I removed
the "+" signs because they weren't in your command prompt version...which
you said works. Anyway, the line should be:


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

This is now equivalent to what you stated in your first post:

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


I recommend using a MessageBox to test code like this... That way you can
see what the strings will look after all the formatting is done.

ShaneB
 
G

Guest

Is there a way to replace c:\exportfiles\d.pdf programatically. That is,
substitute another path before running the Start() method at runtime?
 

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

Top