问题
I am printing a PDF file as follows:
using (GhostscriptProcessor processor = new GhostscriptProcessor())
{
List<string> switches = new List<string>();
switches.Add("-empty");
switches.Add("-dPrinted");
switches.Add("-dBATCH");
switches.Add("-dNOPAUSE");
switches.Add("-dNOSAFER");
switches.Add("-dNumCopies=1");
switches.Add("-sDEVICE=mswinpr2");
switches.Add("-sOutputFile=%printer%" + printerName);
switches.Add("-f");
switches.Add(inputFile);
processor.StartProcessing(switches.ToArray(), null);
}
It works beautifully but I have a problem there. I can't (and really tried) print any PDF file in landscape. I tries with Orientation, with resize, changing the system preferences of the printer. Anything I do is for nothing because it is always printed in portrait.
Any ideas?
回答1:
What problem are you trying to solve ? If you are trying to get the printer to print on landscape media, and that isn't its default, then its not going to work the mswinpr2 device can't change the tray selection.
回答2:
Try something like:
using (GhostscriptProcessor processor = new GhostscriptProcessor())
{
List<string> switches = new List<string>();
switches.Add("-empty");
switches.Add("-dPrinted");
switches.Add("-dBATCH");
switches.Add("-dNOPAUSE");
switches.Add("-dNOSAFER");
switches.Add("-dNumCopies=1");
switches.Add("-sDEVICE=mswinpr2");
switches.Add("-sOutputFile=%printer%" + printerName);
switches.Add("-c");
switches.Add("<</Orientation 3>> setpagedevice");
switches.Add("-f");
switches.Add(inputFile);
processor.StartProcessing(switches.ToArray(), null);
}
来源:https://stackoverflow.com/questions/31158896/print-pdf-using-ghostscript-in-landscape