/004.42Apple_CorePrintingExample

macOS Core Printing example with technical notes.

Primary LanguageSwiftMIT LicenseMIT

macOS Core Printing PDF print example with technical notes.

| PDFPagePrinter | Technical Notes | Utility Routines | Resources |

PDFPagePrinter

PDFPagePrinter is an example Swift macOS Core Printing application which prints multiple ranges of PDF pages using the same printer settings.

screenshot

PDFPagePrinter source code is contained in AppDelegate.swift.

Technical Notes

TN2155_SavingPrinterSettingsForAutomaticPrinting.md provides a possible (unofficial) Swift interpretation of Apple's Objective-C Technical Note TN2155 Saving Printer Settings for Automatic Printing (revision 2007.03.29).

TN2248_UsingCocoaAndCorePrintingTogether.md provides a possible (unofficial) Swift interpretation of Apple's Objective-C Technical Note TN2248 Using Cocoa and Core Printing Together (revision 2009.05.27).

TN2155.swift and TN2248.swift files lightly containing tested Swift implementations for the technical notes code listings.

NOTE: The source code files may contian more complete and up-to-date Swift code than the example listings in the corresponding markdown files.

Utility Routines

PrintUtil.swift provides methods which return a Dictionary of values for various Core Printing OpaquePointer types.

getPMPageFormatInfo(pmPageFormat: PMPageFormat) -> Dictionary<String, Any>
getPMPaperInfo(pmPaper: PMPaper) -> Dictionary<String, Any>
getPMPrinterInfo(pmPrinter: PMPrinter) -> Dictionary<String, Any>
getPMPrintSessionInfo(pmPrintSession: PMPrintSession) -> Dictionary<String, Any>
getPMPrintSettingsInfo(pmPrintSettings: PMPrintSettings) -> Dictionary<String, Any>

Resources

Apple/ApplicationServices: Core Printing ⇗
Apple/Technical Note: TN2155 Saving Printer Settings for Automatic Printing ⇗ 2007-03-29
Apple/TechnicalNote: TN2248 Using Cocoa and Core Printing Together ⇗ 2009-05-27

GitHub/maxbaeumle: splinter ⇗

StackOverflow: How to use UnsafeMutablePointer in Swift? ⇗