To detect connected printer then disconnect and remove printer using CUPS library in Swift language on Mac OS

52 views Asked by At

How can I programmatically disconnect and remove all printers in Mac OS as soon as they connect using the CUPS library in Swift? I've attempted to achieve this by using the cupsRemoveDest() and cupsFreeDest() functions in Swift, and while they appear to disconnect the printer, it still remains visible in "System Settings > Printers & Scanners." Is it possible to completely remove the printer using CUPS in Swift? To detect printers I have used cupsGetDest()

In summary, I'm looking for a way to remove printers from Mac OS via Swift and CUPS so that they are no longer visible in the system settings.

0

There are 0 answers