Contents

locationOfPrintRect(_:)

Invoked by Printview(_:) to determine the location of the region of the view being printed on the physical page.

Declaration

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 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 or isVerticallyCentered return 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.

See Also

Handling Pagination