<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/locationOfPrintRect(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(im)locationOfPrintRect:"
  },
  "title" : "locationOfPrintRect(_:)"
}
-->

# locationOfPrintRect(_:)

Invoked by [`printView(_:)`](/documentation/AppKit/NSView/printView(_:)) to determine the location of the region of the view being printed on the physical page.

```
func locationOfPrintRect(_ rect: NSRect) -> NSPoint
```

## Parameters

`rect`

A rectangle defining a region of the view; it is expressed in the default coordinate system of the page.

## Return Value

A point to be used for setting the origin for `aRect`, whose size the view can examine in order to properly place it. It is expressed in the default coordinate system of the page.

## Discussion

The default implementation places `aRect` according to the status of the [`NSPrintInfo`](/documentation/AppKit/NSPrintInfo) object for the print job. By default it places the image in the upper-left corner of the page, but if the `NSPrintInfo` methods [`isHorizontallyCentered`](/documentation/AppKit/NSPrintInfo/isHorizontallyCentered) or [`isVerticallyCentered`](/documentation/AppKit/NSPrintInfo/isVerticallyCentered) return <doc://com.apple.documentation/documentation/Swift/true>, it centers a single-page image along the appropriate axis. A multiple-page document, however, is always placed so the divided pieces can be assembled at their edges.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)