0

I'm printing some pdf's using Ghostscript.NET this is my config.

List<string> switches = new List<string>
{
    "-empty",
    "-dPrinted",
    "-dFirstPage=1",
    "-dLastPage=1",
    "-dPrinted",
    "-dBATCH",
    "-dNOPAUSE",
    "-dNOSAFER",
    "-dNumCopies=1",
    "-sDEVICE=mswinpr2",
    @"-sFONTPATH=" + System.Environment.GetFolderPath(System.Environment.SpecialFolder.Fonts),
    "-sOutputFile=%printer%" + printQueue.FullName,
    "-f",
    inputFile
};

It works pretty well but my paper size is a custom paper 6.5in x 8.5in, my problem is when I print silent to my ricoh printer, try to print in letter.

How can i do to set my paper size in my switches or force the printer to render it properly.

If i print manually must select the paper and bin manually and all print's perfect.

Juan Pablo Gomez
  • 5,203
  • 11
  • 55
  • 101

2 Answers2

1

The mswinpr2 device uses Windows to do the printing, in particular the media size is set by the printer canvas.

So the answer is to set the default media selection of your printer to the required media size before you start printing.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • Tks for your help, If understood well, it means I set the paper at Control Panel \ Printers \MyPrinter-> Printer settings ? Or there is a programatically way to do that ? – Juan Pablo Gomez Oct 13 '17 at 12:17
  • In the Control Panel was what I meant. I believe it is possible to set these parameters programatically, but offhand I don't know how. – KenS Oct 13 '17 at 18:12
1

You can set the paper size with "-sPAPERSIZE=a4" you can see Paper sizes known to Ghostscript. or you can set it by height and width "-dDEVICEWIDTHPOINTS=w" "-dDEVICEHEIGHTPOINTS=h" Where w be the desired paper width and h be the desired paper height in points (units of 1/72 of an inch).

Shloime Rosenblum
  • 927
  • 11
  • 26