Print to PDF from PrinterDialog?

Hi Folks,

Since it’s possible to Save to PDF from the Print Dialog, has anyone come up with a way to actually do that from code (with an ae, perhaps)? I’ve gotten a request from one of our school customers to provide a hook that prevents the users from eating up the forest when printing reports from our tools. By automatically saving as a PDF, we would automatically eliminate the users’ selecting a printer in the process.

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

For Windows, you need a third party tool, such as MBS DynaPDF http://www.monkeybreadsoftware.de/xojo/plugin-pdf.shtml

For Windows, you could use a PDF printer and set it as default (I am currently using Biopdf)

in the case of printing an HTMLViewer, you could prevent the print dialog from appearing with:

HTMLViewer.Print(False)

On OS X something like
http://www.macupdate.com/app/mac/20219/cups-pdf

On Windows: PDFCreator 1.9.5 or >

pdfforge Download

I’m happy with it.

or via MBS Plugin, just change the destination of the printing:

[code] // get Xojo printer setup
dim p as new PrinterSetup

// now put it into NSPrintInfo to manipulate
dim n as new NSPrintInfoMBS
n.SetupString = p.SetupString

// change destination to file
dim f as FolderItem = SpecialFolder.Desktop.Child(“test.pdf”)
n.SetSaveDestination(f)

// move back
p.SetupString = n.SetupString

// and print as usual
dim g as Graphics = OpenPrinter§
g.DrawString “Hello World”, 20, 20[/code]

I forgot to mark this as answered, but it is exactly what I was looking for (OS X only in this case)!