Here is the code I use as adapted from the MBS example:
[code]Private Sub DoCarbonPrint(PrintFile as Folderitem)
'print the temporary pdf file
'get a print session
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
if thePageFormat = nil then Return
dim thePrintSettings as CPMPrintSettingsMBS = NewCPMPrintSettingsMBS
if thePrintSettings = nil then Return
thePrintSettings.JobName = NewCFStringMBS(theSubject)
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 = PrintFile.OpenAsCGPDFDocumentMBS
if thePdfDocument = nil then Return
'get the last page to be printed
dim LastPage as Integer = thePrintSettings.LastPage
if LastPage > 1000000 then LastPage = thePdfDocument.PageCount
'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
End Sub
[/code]