Search code examples
cocoaprintingnsprintoperationnsprintinfo

Printer options only offer portrait, no option to switch


I'm using [[NSPrintOperation printOperationWithView:drawingView] runOperation]; and I get this view:

printer preview window

There is no option to choose between Landscape or Portrait I found that I can have [[NSPrintOperation printOperationWithView:drawingView printInfo:info] runOperation]; and set info.orientation = NSPaperOrientationLandscape . In that case I would get the preview in landscape but the user does not have the option.

How can I offer the option? (note: I don't see it under 'show Details' either)


Solution

  • Portrait and landscape buttons are in the page layout panel (Page Setup… in the File menu). See NSPageLayout and -[NSApplication runPageLayout:]. It is possible to add the portrait and landscape buttons to the print panel:

    NSPrintPanel *printPanel = printOperation.printPanel;
    printPanel.options |= NSPrintPanelShowsOrientation;
    

    and/or

    printPanel.options |= NSPrintPanelShowsPageSetupAccessory;