Problem with command line function "-Print"

Hi there,

I am using the command line version of the “Print” command, “-Print”, to change page sizes for printing. Later on, I want to use this in a script.

_-Print _Setup _Destination _PageSize

gets me to a prompt saying “Width in mm”. Let’s say I want A2 landscape (European format) so I specify 594.0 and then 420.0 for the height. Now Rhino wrongly assigns 594 to the height parameter and 420 to the width parameter, which I can verify by trying “_PageSize” again or looking into the regular Printing Preview menu which shows the correct A2 format but in portrait mode. This happens for all formats I have tried (A4, A5,…), whenever I specify a valid pair of width/height values for a landscape format, Rhino automatically changes it to portrait. Also, it is independent of the selected printer.

I guess this is a bug report, please let me know if you guys can replicate it.


Hi Matthias- this is probably being switched by the printer driver, I’m told. The driver may set width and height to match the Landscape or Portrait setting so you may have to force it by setting the printer to use Landscape and not Portrait in this case. Does that do anything useful?


Hi Pascal,

thanks for the input - it seems to happen independently from the selected printer, though.

However, your answer leads me to a follow up question / feature request: While I can switch from portrait mode to landscape and back within the Rhino print preview menu, I haven’t found a way of doing this from the command line. If I can’t force landscape/portrait mode by specifying width and height, maybe the “-Print” command line tool should have an option for that, which would do the equivalent of checking the correct box in the menu?


Hi Matthias- I noticed this as well- it is added to the pile for V6:
(not publicly available yet)


Hi Matthias

I am having a related problem. I am trying to print in A4 Portrait. When I set page layout to Portrait in the Page Layout, it changes, but when I try to print, it changes back to Landscape. I have tried saving Portrait as default page layout but it still keeps changing back to Landscape. Not sure if this is a bug, or something to do with my settings.

Anybody have any ideas?

Hi @pascal,

The -print command line options (set to landscape, or set dimensions with the right order) bugs seem to be still here in the latest V6 Serengeti.
We can’t get this command to properly print an A3 in landscape: -_Print _Setup _Destination _Printer ““Microsoft Print to PDF”” _PageSize 420.000 297.000 _Enter _View _AllLayout _Enter _Enter _Go

Any chance to get this working in V6? Or do you have a workaround?


Hi Quentin - you need to remove the extra quotes around the printer name:

““Microsoft Print to PDF”” >>> “Microsoft Print to PDF”

then it should work.

Any luck?


The double quotes are here because the command is used from VB, like this:
Rhino.RhinoApp.RunScript("-_Print _Setup _Destination _Printer ““Microsoft Print to PDF”” _PageSize 420.000 297.000 _Enter _View _AllLayout _Enter _Enter _Go", False)

I’d use chr(34) there then - does that work?

“-_Print _Setup _Destination _Printer " + chr(34) + “Microsoft Print To PDF” + chr(34) + " _PageSize 420.000 297.000 _Enter _View _AllLayout _Enter _Enter _Go”, False



Thanks for the hint but I’m still getting the same portrait A3 with this command:

Rhino.RhinoApp.RunScript(“-_Print _Setup _Destination _Printer chr(34) Microsoft Print To PDF chr(34) _PageSize 420.000 297.000 _Enter _View _AllLayout _Enter _Enter _Go”, False)

or this one:

Rhino.RhinoApp.RunScript(“-_Print _Setup _Destination _Printer chr(34) Microsoft Print To PDF chr(34) _PageSize 297.000 420.000 _Enter _View _AllLayout _Enter _Enter _Go”, False)

And what I need is landscape A3.

This is for a plugin that is going to be deployed on many brand new Rhino installation, so using a manual print first in landscape to keep settings is not an option.


Hi Quentin,
This should be fixed in next week’s WIP. I just pushed a fix for this into our code base.

@mathias - the next WIP will allow the width and height to correctly orient the print… is that sufficient, or were you looking for a command line toggle that would force the print orientation? (regardless, I guess, of the ordering of the numbers- they would just be page size.)



This bug (RH-20548) is fixed in Rhino WIP 6.0.16306.09301 - released just now.

@pascal, thanks for letting me know! If the width and height determine the orientation that will work for us!

Hi @stevebaer, @pascal, thanks for the fix, works perfectly for me as well, in both orientation!

1 Like

Can we get this fixed for 5?

My work will not update to 6 any time soon… if ever.

page size during -Print does not effect anything.

I need to set the print to landscape during the command.

As of now, I am using AutoIT.dll in my plugin. I call my function in a separate thread to find the landscape button, select it, then print.

Sorry, it is highly unlikely that we will be releasing another V5 service release.