Example with print preview

Could someone show me how I can enable print preview, with an example put in button.

Which OS do you use? I use this class here Monkeybread Xojo plugin - NSPrintOperationMBS class for my PDFs on macOS.