How to do Print Preview

I want to implement Print Preview in the Mac version of Check Print’R+ and am encountering a small impediment. Under Windows, margins, orientation and scaling are set in the Printer Setup dialog. So it is pretty easy to then print to a picture instead of the printer.

On Mac, these are in the Print dialog. I also see that most print preview seems to take place in that very dialog. Is there declares or plugins to facilitate that task ? Before I reinvent the wheel :wink:

https://forum.xojo.com/10842-saving-as-pdf-on-mac
?

[code]dim thePdfDocument as new PDFDocumentMBS(PrintFile)

dim thePrintInfo as new NSPrintInfoMBS

thePrintInfo.horizontalPagination = thePrintInfo.NSAutoPagination
thePrintInfo.verticalPagination = thePrintInfo.NSAutoPagination
thePrintInfo.VerticallyCentered = true
thePrintInfo.HorizontallyCentered = true

dim thePrintOperation as NSPrintOperationMBS = thePdfDocument.PrintOperation(thePrintInfo, false, 0)
thePrintOperation.showsPrintPanel = True
thePrintOperation.showsProgressPanel = True
if theSubject = “” then
thePrintOperation.jobTitle = App.getMyAppName
else
thePrintOperation.jobTitle = theSubject
end if

thePrintOperation.runOperationModalForWindow(theWindow)[/code]

This is already converted to 64bit.

Great. Super method. Thank you both :slight_smile: