364,033 Members | 4781 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

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

mg
P: n/a
mg
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\\sys tem32\\notepad.exe","c:\\x.txt"); work fine


Nov 16 '05 #1
Share this Question
Share on Google+
5 Replies


ShaneB
P: n/a
ShaneB
Can you post the code for Process.Start?

ShaneB

"mg" <mg@discussions.microsoft.com> wrote in message
news:6D229754-A8E5-4072-A02C-9F5C3539E021@microsoft.com...[color=blue]
> 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\\sys tem32\\notepad.exe","c:\\x.txt");
> work fine
>
>[/color]


Nov 16 '05 #2

mg
P: n/a
mg
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!

"ShaneB" wrote:
[color=blue]
> Can you post the code for Process.Start?
>
> ShaneB
>
> "mg" <mg@discussions.microsoft.com> wrote in message
> news:6D229754-A8E5-4072-A02C-9F5C3539E021@microsoft.com...[color=green]
> > 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\\sys tem32\\notepad.exe","c:\\x.txt");
> > work fine
> >
> >[/color]
>
>
>[/color]
Nov 16 '05 #3

ShaneB
P: n/a
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

"mg" <mg@discussions.microsoft.com> wrote in message
news:A81E9531-D367-4C41-A2F2-2F675133CB0B@microsoft.com...[color=blue]
> 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!
>
> "ShaneB" wrote:
>[color=green]
>> Can you post the code for Process.Start?
>>
>> ShaneB
>>
>> "mg" <mg@discussions.microsoft.com> wrote in message
>> news:6D229754-A8E5-4072-A02C-9F5C3539E021@microsoft.com...[color=darkred]
>> > 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\\sys tem32\\notepad.exe","c:\\x.txt");
>> > work fine
>> >
>> >[/color]
>>
>>
>>[/color][/color]


Nov 16 '05 #4

mg
P: n/a
mg
Your code works! Thank you very much!



"ShaneB" wrote:
[color=blue]
> 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
>
> "mg" <mg@discussions.microsoft.com> wrote in message
> news:A81E9531-D367-4C41-A2F2-2F675133CB0B@microsoft.com...[color=green]
> > 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!
> >
> > "ShaneB" wrote:
> >[color=darkred]
> >> Can you post the code for Process.Start?
> >>
> >> ShaneB
> >>
> >> "mg" <mg@discussions.microsoft.com> wrote in message
> >> news:6D229754-A8E5-4072-A02C-9F5C3539E021@microsoft.com...
> >> > 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\\sys tem32\\notepad.exe","c:\\x.txt");
> >> > work fine
> >> >
> >> >
> >>
> >>
> >>[/color][/color]
>
>
>[/color]
Nov 16 '05 #5

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



"mg" wrote:
[color=blue]
> Your code works! Thank you very much!
>
>
>
> "ShaneB" wrote:
>[color=green]
> > 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
> >
> > "mg" <mg@discussions.microsoft.com> wrote in message
> > news:A81E9531-D367-4C41-A2F2-2F675133CB0B@microsoft.com...[color=darkred]
> > > 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!
> > >
> > > "ShaneB" wrote:
> > >
> > >> Can you post the code for Process.Start?
> > >>
> > >> ShaneB
> > >>
> > >> "mg" <mg@discussions.microsoft.com> wrote in message
> > >> news:6D229754-A8E5-4072-A02C-9F5C3539E021@microsoft.com...
> > >> > 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\\sys tem32\\notepad.exe","c:\\x.txt");
> > >> > work fine
> > >> >
> > >> >
> > >>
> > >>
> > >>[/color]
> >
> >
> >[/color][/color]
Nov 16 '05 #6

Post your reply

Help answer this question



Didn't find the answer to your C# / C Sharp question?

You can also browse similar questions: C# / C Sharp