All Projects → SuperMarcus → airprint-proxy

SuperMarcus / airprint-proxy

Licence: GPL-3.0 license
Advertise AirPrint printers for network printers located outside the subnet using node. GPL-3.0 licensed.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to airprint-proxy

iOS-AirPrint-for-Mac
enable iOS Airprint Sharing on Mac OS
Stars: ✭ 24 (+4.35%)
Mutual labels:  bonjour, mdns, airprint
MDNS Generic
mDNS Library for nRF52, SAMD21, SAMD51, SAM DUE, STM32F/L/H/G/WB/MP1, AVR Mega, RP2040-based boards, etc. using Ethernet W5x00. Supports mDNS (Registering Services) and DNS-SD (Service Discovery). Ethernet_Generic library is used as default for W5x00
Stars: ✭ 22 (-4.35%)
Mutual labels:  dns-sd, bonjour, mdns
NetService
Swift NetService (Bonjour / Zeroconf / mDNS) implementation for Linux
Stars: ✭ 103 (+347.83%)
Mutual labels:  bonjour, mdns
Ciao
Publish and discover services using Bonjour
Stars: ✭ 50 (+117.39%)
Mutual labels:  bonjour, mdns
Francis
Bonjour browser for macOS and iOS
Stars: ✭ 25 (+8.7%)
Mutual labels:  bonjour, mdns
VCVRack-Holon.ist
Holon.ist Receiver for VCV Rack
Stars: ✭ 13 (-43.48%)
Mutual labels:  bonjour, mdns
mdns-tunneller
Tunnels two (or more) mDNS domains together
Stars: ✭ 74 (+221.74%)
Mutual labels:  mdns
GCXMulticastDNSKit
Multicast DNS framework for iOS
Stars: ✭ 16 (-30.43%)
Mutual labels:  mdns
netdisco
🔎 Python library to scan local network for services and devices.
Stars: ✭ 252 (+995.65%)
Mutual labels:  mdns
mdnsd
Jeremie Miller's original mdnsd
Stars: ✭ 43 (+86.96%)
Mutual labels:  mdns
python-zeroconf
A pure python implementation of multicast DNS service discovery
Stars: ✭ 468 (+1934.78%)
Mutual labels:  bonjour
radiale
What if home automation was homoiconic? Just transformations of data? No more YAML!
Stars: ✭ 21 (-8.7%)
Mutual labels:  mdns
VindicateTool
LLMNR/NBNS/mDNS Spoofing Detection Toolkit
Stars: ✭ 40 (+73.91%)
Mutual labels:  mdns
Servus
Zeroconf discovery in C++
Stars: ✭ 58 (+152.17%)
Mutual labels:  dns-sd
Merhaba
Bonjour networking for discovery and connection between iOS, macOS and tvOS devices.
Stars: ✭ 62 (+169.57%)
Mutual labels:  bonjour
Super-Simple-RGB-WiFi-Lamp
A project based on the ESP8266 and WS2812b
Stars: ✭ 61 (+165.22%)
Mutual labels:  mdns
playercast
Cast to media player and control playback remotely.
Stars: ✭ 46 (+100%)
Mutual labels:  mdns
mdns lite
A simple, no frills mDNS implementation in Elixir
Stars: ✭ 29 (+26.09%)
Mutual labels:  mdns
libmicrodns
Minimal mDNS resolver (and announcer) cross-platform library
Stars: ✭ 48 (+108.7%)
Mutual labels:  mdns
Servus
Ad-hoc peer-to-peer iOS library
Stars: ✭ 27 (+17.39%)
Mutual labels:  bonjour

AirPrint Proxy

____ _ ____ ___  ____ _ _  _ ___    ___  ____ ____ _  _ _   _ 
|__| | |__/ |__] |__/ | |\ |  |     |__] |__/ |  |  \/   \_/  
|  | | |  \ |    |  \ | | \|  |     |    |  \ |__| _/\_   |

Build Status npm version

NPM

Advertise AirPrint printers for network printers located outside the subnet using node. GPL-3.0 licensed.

It's Working!

Copyright (C) 2017 Marcus Zhou

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Introduction

This library provides the ability to create a A record which points to an external printer's ip address, and advertise that printer as a AirPrint supported printer. The only parameters really needed to setup is the ip address.

This library can also be used in scenario like the printer is located in another room under a specific subnet that can be reached by ip address but cannot be reached by multicast packets like mdns. By running this proxy on a device located inside the localnet, the phones and computers should be able to discover the printers.

Node: The remote printer needs to support the MIME type image/urf

The library does not provide any kind of translation functions that converts the Apple Raster format to others, which requires the remote printing server to natively support the format.

Requirements & Compatibility

airprint-proxy requires node version greater or equal 8.3.0 to run.

airprint-proxy is compatible with node 10.

Setup

Install as global package:

# For npm users
npm install -g airprint-proxy

# For yarn users
yarn global add airprint-proxy

Install as dependency:

# For npm users
npm install airprint-proxy

# For yarn users
yarn add airprint-proxy

Usage

AirPrint Proxy comes with both Command Line Interface (CLI) and programmable APIs.

Commands

Install AirPrint Proxy as global package to use the command. (See the section above)

Usage: airprint-proxy [...options] <url|ip>

Available options

Short Full Description Default Value
-p --port The port of the printing server that clients will be connect to 631
-n --name The name of the printer that will be broadcasts to the local network "Untitled Bonjour Printer"
-l --location The notes which will be shown as the location of the printer ""
-q --queue The queue on the printing server which clients will be communicating with "ipp/print"
-c --color Broadcast this printer as a color printer false
-d --duplex Broadcast this printer as duplex supported false
-m --mime-types Specify additional supported MIME types beside 'image/urf'.
-o --txt-record Add additional txt records. (E.g. -o you=me)
-h --help Show help message
-a --automatic Automatically resolve and configure printer from ip address false

Examples

# Automatically resolve the printer's name and capabilities from its ip address
airprint-proxy -a 10.35.0.18

# Broadcast a remote printer at 10.35.0.18 (without asking the printer what it can do)
airprint-proxy 10.35.0.18

# Broadcast the same printer with name "Library Color"
airprint-proxy --name "Library Color" 10.35.0.18

# Broadcast the same printer with name "US Commons" and location "Upper School 1st Floor"
airprint-proxy --name "Library Color" --location "Upper School 1st Floor" 10.35.0.18

APIs

The PrinterProxy object is setup to manage all mdns requests, so be sure to instantiate one every time.

//CommonJS style
const APProxy = require("airprint-proxy");
const PrinterProxy = APProxy.PrinterProxy;
const Printer = APProxy.Printer;

//ES6 style
import { PrinterProxy, Printer } from "airprint-proxy";

let proxy = new PrinterProxy();

Use Printer to represent each printer.

//This is the complex way
let printer = new Printer(
    "10.35.0.18",            //IP Address <required>
    "Library Color Printer", //Name <optional>
    631,                     //Port <optional>
    "Media Center",          //Notes, will be displayed as Location <optional>
    "library-color.local"    //A proper hostname, make sure it is not duplicated <optional>
);

//Use URL to specify queue and include everything
let printer2 = new Printer(
    "ipp://10.20.0.95:631/ipp/print",
     "US Life Center",
     "Upper School 1st Floor");

//Or you can just give the ip address, the name will be set to like
// Untitled Bonjour Printer 10341
let anotherPrinter = new Printer("10.20.0.92");

//Add the printers to make proxy publish those printers
proxy.addPrinter(printer);
proxy.addPrinter(printer2);
proxy.addPrinter(anotherPrinter);

As of 1.2.0, you can let PrinterProxy automatically resolve the name and capabilities of the printer on a remote server supporting unicast dns service discovery. (e.g. a cups server)

You may need to adjust your printer's firewall & mdns responder settings to allow dns sd queries from your address.

//Resolve the printers broadcasting on 10.35.0.18
proxy.resolvePrinter("10.35.0.18");

//The optional callback function accepted in the second argument
proxy.resolvePrinter("10.35.0.18", (error, resolvedPrinters) => {
    //The 'error' parameter is null when successfully resolved the
    // printer, and an 'Error' object on error
    if(error){
        console.error("Error resolving printer", error);
    }
    
    //The 'resolvedPrinters' parameter is null when an error occurred.
    // An array of 'Printer' object on success
})

See src/test.js for more examples.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].