Mac Developer Library

Developer

AppKit Framework Reference NSPDFPanel Class Reference

Options
Deployment Target:

On This Page
Language:

NSPDFPanel

An NSPDFPanel object is used to implement a Save or Export as PDF panel that’s consistent with the OS X user interface. A PDF panel has a variety of built-in customization controls, such as page orientation, paper size, and tags. It also supports the use of a custom accessory view controller that allows an app to specify how a PDF file should be created.

Inheritance


Conforms To


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.9 and later.
  • Returns a new NSPDFPanel object.

    Declaration

    Objective-C

    + (NSPDFPanel *)panel

    Return Value

    A new NSPDFPanel object or nil if an error occurred.

    Import Statement

    Availability

    Available in OS X v10.9 and later.

  • A view controller for the accessory view that the panel can present.

    Declaration

    Swift

    var accessoryController: NSViewController?

    Objective-C

    @property(strong) NSViewController *accessoryController

    Discussion

    The PDF panel passes an NSPDFInfo object to the accessory view controller to display the various attributes associated with the PDF file. Unlike a print panel (that is, an NSPrintPanel object), a PDF panel can have only one accessory view.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.9 and later.

  • options options Property

    A set of configuration options that determine the accessory views the PDF panel should display.

    Declaration

    Swift

    var options: NSPDFPanelOptions

    Objective-C

    @property NSPDFPanelOptions options

    Discussion

    You specify a set of options by combining the appropriate constants defined in NSPDFPanelOptions.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.9 and later.

  • The initial value for the user-editable filename shown in the name field of the PDF panel.

    Declaration

    Swift

    var defaultFileName: String!

    Objective-C

    @property(copy) NSString *defaultFileName

    Discussion

    The defaultFileName string should never include a file extension. By default, the string’s value is “Untitled” (or its equivalent for the current locale).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.9 and later.

  • Presents a document-modal PDF panel.

    Declaration

    Swift

    func beginSheetWithPDFInfo(_ pdfInfo: NSPDFInfo!, modalForWindow docWindow: NSWindow!, completionHandler completionHandler: ((Int) -> Void)!)

    Objective-C

    - (void)beginSheetWithPDFInfo:(NSPDFInfo *)pdfInfo modalForWindow:(NSWindow *)docWindow completionHandler:(void (^)(NSInteger))completionHandler

    Parameters

    pdfInfo

    The NSPDFInfo object describing the parameters to be used when creating the PDF file.

    docWindow

    The window in which the PDF panel will be presented.

    completionHandler

    The block called when the user dismisses the PDF panel.

    Discussion

    This method presents a slightly different PDF panel depending on whether the NSPDFPanelRequestsParentDirectory constant is set. If the user dismisses the panel without canceling it, this method updates the NSPDFInfo object with any changes the user makes.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.9 and later.

  • Constants used to configure the contents of a PDF panel.

    Declaration

    Swift

    struct NSPDFPanelOptions : RawOptionSetType { init(_ rawValue: Int) init(rawValue rawValue: Int) static var ShowsPaperSize: NSPDFPanelOptions { get } static var ShowsOrientation: NSPDFPanelOptions { get } static var RequestsParentDirectory: NSPDFPanelOptions { get } }

    Objective-C

    enum { NSPDFPanelShowsPaperSize = 1 << 2, NSPDFPanelShowsOrientation = 1 << 3, NSPDFPanelRequestsParentDirectory = 1 << 24 }; typedef NSInteger NSPDFPanelOptions;

    Constants

    • ShowsPaperSize

      NSPDFPanelShowsPaperSize

      The PDF panel shows a menu of paper sizes.

      Available in OS X v10.9 and later.

    • ShowsOrientation

      NSPDFPanelShowsOrientation

      The PDF panel shows the current orientation of the PDF contents, such as landscape or portrait.

      Available in OS X v10.9 and later.

    • RequestsParentDirectory

      NSPDFPanelRequestsParentDirectory

      The PDF panel doesn’t show a name field; instead, it allows the user to identify a directory in which to save multiple PDF files. If you set this flag, you’re responsible for appending a filename and the "pdf" extension to the resulting URL value in the NSPDFInfo object before proceeding with the creation of the PDF file (or calling the takeSettingsFromPDFInfo method of NSPrintInfo).

      Available in OS X v10.9 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.9 and later.