Platforms to show: All Mac Windows Linux Cross-Platform

NSPrintInfoMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Cocoa Printing MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
An NSPrintInfo object stores information that's used to generate printed output.
// get Xojo printer setup
Var p as new PrinterSetup

// now put it into NSPrintInfo to manipulate
Var n as new NSPrintInfoMBS
n.SetupString = p.SetupString

// change destination to file
Var f as FolderItem = SpecialFolder.Desktop.Child("test.pdf")

// move back
p.SetupString = n.SetupString

// and print as usual
Var g as Graphics = OpenPrinter(p)
g.DrawString "Hello World", 20, 20

A shared NSPrintInfo object is automatically created for an application and is used by default for all printing jobs for that application.

The printing information in an NSPrintInfo object is stored in a dictionary. To access the standard attributes in the dictionary directly, this class defines a set of keys and provides the dictionary method. You can also initialize an instance of this class using the Constructor method.

You can use this dictionary to store custom information associated with a print job. Any non-object values should be stored as NSNumber or NSValue objects in the dictionary. See NSNumber Class Reference for a list of types which should be stored as numbers. For other non-object values, use the NSValue class.

Beginning with OS X v10.5, to store custom information that belongs in printing presets you should use the dictionary returned by the printSettings method.

Pagination Modes

Constant Value Description
NSAutoPagination 0 The image is divided into equal-sized rectangles and placed in one column of pages.
NSClipPagination 2 The image is clipped to produce one column or row of pages.
NSFitPagination 1 The image is scaled to produce one column or one row of pages.

Page Orientation Constants

Constant Value Description
NSLandscapeOrientation 1 Orientation is portrait (page is taller than it is wide).
NSPortraitOrientation 0 Orientation is landscape (page is wider than it is tall).

Duplex Modes

Constant Value Description
PMDuplexNone 1 Print only on one side of sheet of paper
PMDuplexNoTumble 2 Print on both sides of the paper, with no tumbling.
PMDuplexTumble 3 Print on both sides of the paper, tumbling on.
PMSimplexTumble 4 Print on only one side of the paper, but tumble the images while printing.

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries

Release notes

The items on this page are in the following plugins: MBS MacCocoa Plugin.

NSPrinterMBS   -   NSPrintOperationMBS

The biggest plugin in space...