Contents

PMSetLastPage(_:_:_:)

Sets the page number of the last page to be printed.

Declaration

func PMSetLastPage(_ printSettings: PMPrintSettings, _ last: UInt32, _ lock: Bool) -> OSStatus

Parameters

  • printSettings:

    The print settings object whose last page number you want to set.

  • last:

    The page number of the last page to print. This value appears in the To field of the Print dialog. Pass the constant kPMPrintAllPages to print the entire document.

  • lock:

    The lock state of the setting. Locking is not supported at this time.

Return Value

A result code. See Result Codes.

Discussion

Typically, you call this function after the Print dialog is displayed to indicate the number of the last page number to be printed. In macOS, setting the last page provides information used by the progress dialog that is shown during printing.

If you call the function PMSetPageRange(_:_:_:) and then call PMSetFirstPage or PMSetLastPage using the same page range you specified for PMSetPageRange, then the Print dialog shows the From button selected. If you use the constant kPMPrintAllPages to set the page range with the function PMSetPageRange, then the Print dialog opens with the All button selected regardless of whether you also call PMSetFirstPage or PMSetLastPage.

If you call this function after initiating a print job, the change is ignored for the current job.

See Also

Accessing Data in Print Settings Objects