macOS Printing to an Unsupported Windows Printer

I have an old Canon MF5650 printer connected to a Windows Server 2016 as a network printer. It was already a challenge to find a working x64 Windows driver, let alone a driver for macOS.

Fortunately, macOS supports printing to PDF file natively, and copying that PDF file to a Windows computer and printing it from there can be automated.

Setup

  1. Install Folder Agent.
  2. Run Folder Agent and start Tools » Install Windows Service.
  3. Optional:
    1. Create a regular user.
    2. Grant user Log on as a service right.
    3. Grant user read&write permission to %ProgramData%\Folder Agent folder. This is the folder the Folder Agent service reads its config file from and writes a log file to.
    4. Modify the Folder Agent service to run as this user.
    5. Make sure you also grant this user read&write permission to any folder it will monitor.

    Changing service user has some advantages. By default the Folder Agent runs its service as the Local System user. This is too much privilege for a print job.

    Furthermore, one can easily log in as this user and make user’s setting adjustments: like selecting the default printer.

  4. Download PDFtoPrinter utility. Adobe End-user Licence Agreement does not allow you to use the Adobe Reader for automated printing.
  5. Create a spool folder (e.g. D:\Users\Public\Spool\print).
  6. Setup spool folder permissions:
    1. Grant users you want to allow printing create file permission.
    2. Grant CREATOR OWNER full permission.
    3. Optional: Grant user from step 3 read&write permission.
    4. Administrators group and SYSTEM user should have full permission as usual.
  7. Setup Folder Agent to monitor the spool folder. Use a Decision element to select files where {{ path | extension }} matches .pdf, and run the PDFtoPrinter utility. Afterwards, delete the file. A snippet of my exact Folder Agent setting from the folderagent.xml file is:
    <FolderMonitor Folder="D:\Users\Public\Spool\print" FilesToMatch="" FilesToIgnore="desktop.ini" Title="Print Spool" DatabasePath="7f1cb43d-7287-48ee-ac13-13e569331c45.db" Guid="2ac0ff44-f6db-408e-b4f0-758591c522e9">
      <Stability2 Every="3" Unit="Seconds" />
      <PollInterval Every="-1" Unit="Milliseconds" />
      <Children>
        <ProxyTreeObject type="Decision.Decision">
          <Decision Title="PDF">
            <Children>
              <ProxyTreeObject type="RunProgram.RunProgram">
                <RunProgram Program="C:\Users\FolderAgent\Downloads\PDFtoPrinter.exe" Parameters="&quot;{{ path }}&quot; &quot;Canon MF5650&quot;" Timeout="-1" CheckReturnValue="Is_Zero" Title="Print with PDFtoPrinter">
                  <Retry>
                    <TimeBetweenRetries Every="1" Unit="Seconds" />
                  </Retry>
                </RunProgram>
              </ProxyTreeObject>
              <ProxyTreeObject type="DeleteFile.DeleteFile">
                <DeleteFile PermanentlyDelete="true" />
              </ProxyTreeObject>
            </Children>
            <Rules Apply="Any">
              <RulesCollection>
                <Rule Value=".pdf" Template="{{ path | extension }}" Condition="Equals" />
              </RulesCollection>
            </Rules>
          </Decision>
        </ProxyTreeObject>
      </Children>
      <OnError type="ActionList.ActionList">
        <ActionList>
          <Title>On Error in Monitor</Title>
          <Children />
        </ActionList>
      </OnError>
    </FolderMonitor>
    

    The XML is quite self-explanatory. However, some things should be noted. First, I allowed 3sec before processing files. This allows macOS to write PDF directly to the spool folder without a worry that Folder Agent might pick up the file before it is finished.

    Furthermore, Folder Agent will check PDFtoPrinter result to throw an error on failure. This prevents continuing (i.e. deleting the PDF file).

    Last but not least, the PDF files are deleted permanently to keep the Recycle Bin clean.

Usage

Now that you spool folder is ready, just print from any macOS application to a PDF file and save that PDF to the spool folder.

As a matter of fact, you can print any PDF file from your phone or tablet providing you can access your spool folder.

The Folder Agent spool folder monitor can be extended to print Word and Excel documents too if you can work out how to print DOCX and XLSX documents from the command line.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.