Set default printer via COM

Hi All,
many years ago I think I used something like this to temporarily set PDFCreator as defaultPrinter and change it back aftewards:

DefaultPrinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := 'PDFCreator';
PDFCreator.cPrinterStop := FALSE;

// Dynamics Nav statement to run and print a report to the system default printer

PDFCreator.cDefaultPrinter := DefaultPrinter;

I cannot seem to find a way to set and restore the default printer with COM version > 2.0, however. Anyone has any tips?
Thanks in advance!


while PDFCreator doesn't provide this function anymore, there is most likely an alternative way of setting this in your code.
Which language are you using? It might have some native functions/wrappers to handle Windows printers.

Best regards


I'm intergrating this into the Dynamics NAV Classic Client using C/AL: There's no way to directly set the default printer but I can handle this with a bit of additional C/AL Code for selecting the correct printers. But I liked that old feature very much :slight_smile:
Thanks for clarificiation!