I want to programatically print a PDF file to the "Adobe PDF" printer... the Adobe-supplied printer driver that creates a PDF file (rather than output to the printer). In other words, creating (via print) a PDF file from a PDF file... this is to reduce the size of the original PDF, which has lots of form fields and javascript.
Dim viewer As PdfViewer = New PdfViewer()
viewer.OpenPdfFile(fn)
viewer.PrintPageDialog = False 'do not produce the page number dialog when printing
Dim ps As System.Drawing.Printing.PrinterSettings = _
New System.Drawing.Printing.PrinterSettings()
ps.PrinterName = "Adobe PDF"
viewer.PrintDocumentWithSettings(ps)
viewer.ClosePdfFile()
This code sequence fails silently at the "PrintDocumentsWithSettings()" line.
If I simply print to the default printer (ie. remove the ps.PrinterName line), it prints fine.