Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.
Platforms to show: All Mac Windows Linux Cross-Platform
NewCPMPageFormatMBS as CPMPageFormatMBS
Function:
Creates a new page format object.
Notes: Returns nil on any error.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
global method | Printing | MBS MacCG Plugin | 2.7 | Yes | No | No | No | No |
Notes: Returns nil on any error.
Some examples using this method:
NewCPMPrintSessionMBS as CPMPrintSessionMBS
Function:
Creates a new print session object.
Example:
Notes:
Returns nil on any error.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
global method | Printing | MBS MacCG Plugin | 2.7 | Yes | No | No | No | No |
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
Some examples using this method:
NewCPMPrintSettingsMBS as CPMPrintSettingsMBS
Function:
Creates a new print settings object.
Notes: Returns nil on any error.
Type | Topic | Plugin | Version | macOS | Windows | Linux | Console & Web | iOS |
global method | Printing | MBS MacCG Plugin | 2.7 | Yes | No | No | No | No |
Notes: Returns nil on any error.
Some examples using this method:
The items on this page are in the following plugins: MBS MacCG Plugin.
Links
MBS FileMaker Plugins