4
Answers

Command Line Print embedded in C# not working

Abdullah Arshad

Abdullah Arshad

12y
4.6k
1
HI There

I'm using FOXIT READER to print a PDF to a network.

When I run the following in command line at DOS prompt

C:\Program Files (x86)\Foxit Software\Foxit Reader>"foxit reader.exe" /t "c:\po222.pdf" "\\CCS-BAR-001\NRG SP 4100N PS 

It works fine

 
However, when I embed the command line into Visual Studio C# using the Process Class, it fails to recognize the printer name.

 

I think this has something to do with there being both a double forward slash and single forward slash in the printer name which C# is failing to recognise even though I am using @ in front of the string to represent the literal string.

 

My C# code is :

 

            string testFile = "c:\\po222.pdf";

            string testPrinter = @"\\CCS-BAR-001\NRG SP 4100N PS";

 

            Process pdfProcess = new Process();

            pdfProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;

            pdfProcess.StartInfo.FileName = @"C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe";

            pdfProcess.StartInfo.Arguments = string.Format("/t {0} {1}", testFile, testPrinter);

            pdfProcess.StartInfo.CreateNoWindow = false;

            pdfProcess.Start();

            pdfProcess.CloseMainWindow();

I can't see what I'm doing wrong. Can you spot anything out of place.

 

Any help would be gratefully received.
 

Kind regards

 

Abdullah

Answers (4)
0
Pratheesh s

Pratheesh s

NA 5 1.7k 10y
Can any one could solve this problem, if yes plz help me to solve it.
0
Pratheesh s

Pratheesh s

NA 5 1.7k 10y
hai Sanjay Kumar,

Thanks for your valuable reply, Actually what iam trying to implement is to make a repeater user control that can generate dynamic columns , that is if i use that repeater in a web form with 3 columns  i must be able to use that repeater control in the next web form for more than or less than 3 columns , so the problem is i need to bind that data with out using source code, that is "Eval" method can only add one data from a particular table only, i need to generalize that part and need to made that part data binding in general, so can i bind data to a repeater without source code by using only code behind.

Please pardon me if there is any confusions, ask me for more clarifications to my idea.
0
Sanjay Kumar

Sanjay Kumar

NA 5.8k 2.8m 10y