0

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?

Miquel Coll
  • 759
  • 15
  • 49
  • Try adding `-dORIENT1=false` as an option. If that doesn't work, try setting it to true. This flips the internal representation of page orientation, which may help if the PDF has an explicit embedded orientation. – Polynomial Jul 01 '15 at 10:38
  • not working either... :( – Miquel Coll Jul 01 '15 at 10:48
  • Might be helpful: http://stackoverflow.com/questions/3089773/how-to-change-page-orientation-of-pdf-ghostscript-or-postscript-solution-neede – Craig Jul 01 '15 at 11:23

2 Answers2

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.

KenS
  • 30,202
  • 3
  • 34
  • 51
0

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);
}
HABJAN
  • 9,212
  • 3
  • 35
  • 59