Platforms to show: All Mac Windows Linux Cross-Platform

Back to CPMPrintSettingsMBS class.

CPMPrintSettingsMBS.Collate as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The collate setting.

(Read and Write computed property)

CPMPrintSettingsMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 9.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a new print settings object.

CPMPrintSettingsMBS.Copies as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The number of copies that the user requests to be printed.

Lasterror is set.
(Read and Write computed property)

CPMPrintSettingsMBS.CopyPrintSettings(dest as CPMPrintSettingsMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Copes the settings to the other settings.

CPMPrintSettingsMBS.CreateDataRepresentation(Format as Integer = 0) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a data representation of a PMPageFormat object as a data string.
Example
dim p as new CPMPrintSettingsMBS
p.Collate = true
p.Duplex = p.kPMDuplexTumble
dim data as string = p.CreateDataRepresentation
Break // check in debugger

CPMPrintSettingsMBS.Dictionary as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Represent these print settings as a dictionary.

CPMPrintSettingsMBS.Duplex as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The duplex setting.

(Read and Write computed property)

CPMPrintSettingsMBS.FirstPage as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The number of the first page to print.

Lasterror is set.
(Read and Write computed property)

Some examples using this property:

CPMPrintSettingsMBS.GetPageRange(byref minPage as UInt32, byref maxPage as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Queries the page range to print.

Obtains the valid range of pages that can be printed.
The default page range is 1 - (all pages). The page range is something that is set by the application. It is NOT the first and last page to print. It serves as limits for setting the first and last page.

CPMPrintSettingsMBS.JobName as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 12.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Specifies the name of a print job.

Lasterror is set.
(Read and Write computed property)

CPMPrintSettingsMBS.Keys as String()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Queries list of keys.
Example
dim p as new CPMPrintSettingsMBS
p.Collate = true
p.Duplex = p.kPMDuplexTumble
dim keys() as string = p.keys
Break // check in debugger

CPMPrintSettingsMBS.LastPage as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The number of the last page to print.
Example
'get a print session

// print this PDF
dim pathPrinted as FolderItem=GetFolderItem("test.pdf")

dim thePrintSession as CPMPrintSessionMBS = NewCPMPrintSessionMBS
if thePrintSession = nil then Return

'get default page format and print settings and attach it to the print settings
dim thePageFormat as CPMPageFormatMBS = NewCPMPageFormatMBS
dim thePrintSettings as CPMPrintSettingsMBS = NewCPMPrintSettingsMBS
thePrintSession.DefaultPageFormat thePageFormat
thePrintSession.DefaultPrintSettings thePrintSettings

'show the print dialog
if not thePrintSession.PrintDialog(thePrintSettings,thePageFormat) then return

'open the file which will be printed
dim thePdfDocument as CGPDFDocumentMBS = pathPrinted.OpenAsCGPDFDocumentMBS

' limit page counts to the one we have
dim LastPage as Integer = thePdfDocument.PageCount
if thePrintSettings.LastPage<lastpage then
lastpage=thePrintSettings.LastPage
end if

' you get better progress bar if you tell how many pages will come
thePrintSettings.LastPage=lastpage

'begin the printing
thePrintSession.BeginDocument(thePrintSettings, thePageFormat)

'loop over the number of copies
for currentCopy as Integer = 1 to thePrintSettings.Copies

'loop over the pages
for currentPage as Integer = thePrintSettings.FirstPage to LastPage

'prepage the page
dim PrintRect as CPMRectMBS =thePageFormat.AdjustedPageSize
dim CGRect as CGRectMBS =CGMakeRectMBS(PrintRect.left, PrintRect.top, PrintRect.Width, PrintRect.Height)
thePrintSession.BeginPage(thePageFormat, nil)
dim thePrintContext as CGContextMBS = thePrintSession.PageContext
if thePrintContext = Nil then return

'print the page
thePrintContext.DrawCGPDFDocument thePdfDocument, CGRect, currentPage

'end the page
thePrintContext = nil
thePrintSession.EndPage
next

next

'end the printing
thePrintSession.EndDocument

Lasterror is set.
(Read and Write computed property)

Some examples using this property:

CPMPrintSettingsMBS.SetPageRange(minPage as UInt32, maxPage as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the page range to print.

CPMPrintSettingsMBS.Value(key as String) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Printing MBS MacCG Plugin 15.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The value in settings.
Example
dim p as new CPMPrintSettingsMBS
p.Collate = true
dim value as Variant = p.value("com.apple.print.PrintSettings.PMCopyCollate")
Break // check in debugger

(Read and Write computed property)

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


The biggest plugin in space...