I need to write a "virtual printer driver" for OSX, so that when the user presses Command+P to open the Print dialog, he sees my virtual printer...which will be used to generate files of various types, instead of physically printing to paper.
I'm new to the subject, I looked around a bit but found nothing. Do you have any link or reference to documentation that cover this topic?
Add a virtual printer to Mac OSChoose System Preferences from the Apple menu, and then choose Print & Fax. Click the "+" button to add a printer. Click IP or IP Printer in the Printer Browser dialog box.
The first place is in /System/Library/Printers/. This directory contains printer drivers that are included with the Mac OS by Apple.
Most printers are compatible with macOS. When you add a printer, macOS automatically uses AirPrint to connect to the printer or downloads the printer's software (also called a printer driver).
There is already a driver that does that. VipRiser installs a printer that saves to a file. I use it to 'print out' to a file sheet music I buy online. The existing 'Save to PDF' options at the bottom of the printer dialog won't work because the vendor of the music has disabled this function and you must print to a printer.
For the broadest and simplest support for printing to a virtual printer I use VipRiser rather than using PDF services. PDF Services work in some cases but many sites are preventing the use of PDF Services.
In case the printer driver is absolutely needed and the PDF services are not suitable.
The solution is to write your own CUPS driver - both Mac OS and Linux use CUPS for printing, so solution could work for both systems.
The documentation for CUPS provides an instruction on writing a driver (https://www.cups.org/doc/postscript-driver.html), which generally consists of creating:
There's a good tutorial on how to write one in python: https://behind.pretix.eu/2018/01/20/cups-driver/ and provides example open source for driving a FGL printer: https://github.com/pretix/cups-fgl-printers that can be adapted to your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With