2

I'm trying to print pcl file using lpr command. here my C# application create a new process to invoke lpr command with argument includes pcl file name and few more.

but now i'm facing issue because lpr command only accept 128 length file names. But my pcl file path longer than that. I tried to set the process working directory as the pcl file folder. although I set it, lpr.exe refer the absolute path to check the file existence.

Is there any innovative idea to get rid from this file path length issue?

Proc.StartInfo.WorkingDirectory = pcl_file.Directory.ToString();
Proc.StartInfo.FileName = "lpr";
Proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
Proc.StartInfo.UseShellExecute = false;
Proc.StartInfo.RedirectStandardOutput = true;
Proc.Start();
Nayana Adassuriya
  • 23,596
  • 30
  • 104
  • 147

1 Answers1

0

A quick cheat might be to use the short filename. Use Getshortpath

Douglas Anderson
  • 4,652
  • 10
  • 40
  • 49