Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSPrintInfoMBS class.

NSPrintInfoMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Printing MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initializes the print info with a new instance.
Example
// get Xojo printer setup
dim p as new PrinterSetup

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

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

// move back
p.SetupString = n.SetupString

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

See also:

NSPrintInfoMBS.Constructor(attributes as Dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Printing MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initialize the print info with the parameters in the specified dictionary.

See also:

NSPrintInfoMBS.Constructor(Data as Memoryblock)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Printing MBS MacCocoa Plugin 14.3 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Initialize the print info with serialized dictionary or NSPrintInfo.
Example
dim p as new PrinterSetup
dim info as new NSPrintInfoMBS(p.SetupString)
MsgBox info.paperName

See also:

NSPrintInfoMBS.copy as NSPrintInfoMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Printing MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Creates a copy of the object.

NSPrintInfoMBS.SetSaveDestination(file as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Printing MBS MacCocoa Plugin 14.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the print job to go to a PDF file.
Example
// print to PDF in Xojo Cocoa app

// change print info to go to
dim s as NSPrintInfoMBS = NSPrintInfoMBS.sharedPrintInfo
dim d as MemoryBlock = s.data // save old
s.SetSaveDestination SpecialFolder.Desktop.Child("test.pdf")

// now print something
dim g as Graphics = OpenPrinter
if g<>Nil then
g.DrawString "Hello World PDF", 20, 20
end if


s.data = d // restore original settings

// now print something to regular printer
g = OpenPrinter
if g<>Nil then
g.DrawString "Hello World Printer", 20, 20
end if

Some examples using this method:

NSPrintInfoMBS.setUpPrintOperationDefaultValues

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Printing MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Validates the attributes encapsulated by the receiver.

Invoked when the print operation is about to start. Subclasses may override this method to set default values for any attributes that are not set.

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


The biggest plugin in space...