Juan Pablo Gomez
Juan Pablo Gomez

Reputation: 5524

set papersize Printing with Ghostscript.NET

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.

Upvotes: 0

Views: 1291

Answers (2)

Shloime Rosenblum
Shloime Rosenblum

Reputation: 1020

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).

Upvotes: 1

KenS
KenS

Reputation: 31141

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.

Upvotes: 1

Related Questions