Hello,
i've tried to use this fine library to print a file as suggested on stackoverlow.
Used x64 and latest GPL GhostScript library.
Used all posiible options, but no luck, always get error -100.
PDF is very simple and can be rendered by Viewer without any problems.
input: name of PDF file
output: name of printer
Tried use with %printr% and spool.
Tried drivers mswinpr2, pswrite, ljet4.
Here an example code:
Alex
i've tried to use this fine library to print a file as suggested on stackoverlow.
Used x64 and latest GPL GhostScript library.
Used all posiible options, but no luck, always get error -100.
PDF is very simple and can be rendered by Viewer without any problems.
input: name of PDF file
output: name of printer
Tried use with %printr% and spool.
Tried drivers mswinpr2, pswrite, ljet4.
Here an example code:
private void Process(string input, string output, int startPage, int endPage)
{
//-dPrinted -dBATCH -dNOPAUSE -sDEVICE=mswinpr2 -dNoCancel -sOutputFile="%printer%printer name" "pdfdocument.pdf"
List<string> switches = new List<string>();
//switches.Add("-empty");
switches.Add("-dPrinted");
//switches.Add("-dSAFER");
switches.Add("-dBATCH");
switches.Add("-dNOPAUSE");
switches.Add("-dNOPROMPT");
switches.Add("-dQUIET");
//switches.Add("-sDEVICE=mswinpr2");
//switches.Add("-sDEVICE=pswrite");
switches.Add("-sDEVICE=ljet4");
switches.Add("-dNoCancel");
//switches.Add(@"-sOutputFile=""%printer%" + output + @"""");
switches.Add("-sOutputFile=\"\\\\spool\\" + output + "\"");
//switches.Add(@"-sOutputFile=""" + output + @"""");
switches.Add(@"-sFONTPATH=" + System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts));
switches.Add("-dFirstPage=" + startPage.ToString());
switches.Add("-dLastPage=" + endPage.ToString());
switches.Add(@"-f""" + input + @"""");
//switches.Add(@"""" + input + @"""");
using (Ghostscript.NET.Processor.GhostscriptProcessor processor = new Processor.GhostscriptProcessor(_gs_verssion_info, true))
{
//processor.Process(CreateTestArgs(input, output, startPage, endPage), new ConsoleStdIO(true, true, true));
processor.StartProcessing(switches.ToArray(), null);
}
}
```
Man thanks in advice!
Alex