{"_id":"@c_phillips/ipp-browser","name":"@c_phillips/ipp-browser","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@c_phillips/ipp-browser","version":"1.0.0","type":"module","main":"./dist/lib/printer.js","repository":{"type":"git","url":"git+https://github.com/cphillips/ipp-browser.git"},"description":"IPP for the browse and node","scripts":{"test":"tsx test.ts","build":"tsc","prepublish":"tsc"},"author":{"name":"Clint Phillips"},"contributors":[{"name":"Cristian Della Monica"}],"license":"MIT","dependencies":{"buffer":"^6.0.3"},"devDependencies":{"@types/axios":"^0.14.0","@types/concat-stream":"^2.0.0","@types/lodash":"^4.14.196","@types/pdfkit":"^0.12.11","axios":"^1.5.0","concat-stream":"^2.0.0","pdfkit":"^0.13.0","tsx":"^3.12.10","typescript":"^5.1.6","vite":"^4.4.9"},"bugs":{"url":"https://github.com/cphillips/ipp-browser/issues"},"homepage":"https://github.com/cphillips/ipp-browser#readme","keywords":["ipp","ipp-browser","print","web-print","web","browser"],"publishConfig":{"access":"public"},"gitHead":"d763229df09a67c8366edfb11d73c1416272c897","types":"./dist/lib/printer.d.ts","_id":"@c_phillips/ipp-browser@1.0.0","_nodeVersion":"20.4.0","_npmVersion":"9.7.2","dist":{"integrity":"sha512-QKzAmwWxGfxWiWFZL3Dcqkzs593MZO8PzHTZs/HwJ2JFOQ7eZSTtUIj9AM316iHCg0Dts0tolxWjKjwjVKLYCw==","shasum":"5eab2a491d48d50438ae5220a86818f30bbfebfa","tarball":"https://registry.npmjs.org/@c_phillips/ipp-browser/-/ipp-browser-1.0.0.tgz","fileCount":70,"unpackedSize":399487,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDh0Hli9xVdEq93G14dqrouqecaYyUXxsn5fGSvm8w0nwIgMsKF1tf4HUgHGEktziiwKqstTYDPekn0rUjjTJWkhMA="}]},"_npmUser":{"name":"c_phillips","email":"clint@ngm.net"},"directories":{},"maintainers":[{"name":"c_phillips","email":"clint@ngm.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipp-browser_1.0.0_1695345785997_0.8321720751102473"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-22T01:23:05.860Z","1.0.0":"2023-09-22T01:23:06.174Z","modified":"2023-09-22T01:23:06.436Z"},"maintainers":[{"name":"c_phillips","email":"clint@ngm.net"}],"description":"IPP for the browse and node","homepage":"https://github.com/cphillips/ipp-browser#readme","keywords":["ipp","ipp-browser","print","web-print","web","browser"],"repository":{"type":"git","url":"git+https://github.com/cphillips/ipp-browser.git"},"contributors":[{"name":"Cristian Della Monica"}],"author":{"name":"Clint Phillips"},"bugs":{"url":"https://github.com/cphillips/ipp-browser/issues"},"license":"MIT","readme":"# ipp-browser\nIPP-browser is a powerful library that brings the power of Internet Printing Protocol (IPP) directly into the browser.\nInspired by the work of [William Kapke](https:///github.com/williamkapke/ipp), this library extends the use of IPP to the browser.\nWith this library, you can easily integrate printing to IPP-compatible network devices directly from your web applications without having to rely on additional plugins or software.\n## Installation\n​\n#### npm\n```sh\n$ npm install @cphillips/ipp-browser --save\n```\n​\n#### yarn\n```sh\n$ yarn add @cphillips/ipp-browser\n```\n​\n## API\n​\n​\n### Printer(url [,options])\nTo interact with a printer, create a `Printer` object.\n​\n**options:**\n* `charset` - Specifies the value for the 'attributes-charset' attribute of requests. Defaults to `utf-8`.\n* `language` - Specifies the value for the 'attributes-natural-language' attribute of requests. Defaults to `en-us`.\n* `uri` - Specifies the value for the 'printer-uri' attribute of requests. Defaults to `ipp://+url.host+url.path`.\n* `version` - Specifies the value for the 'version' attribute of requests. Defaults to `2.0`.\n​\n​\n### Printer.encodeMsg(operation, msg)\nConverts an IPP message object to IPP binary.\n​\n* 'operation' - There are many operations defined by IPP. See: [/lib/types.ts](https://github.com/digasystems/ipp-browser/blob/main/lib/types.ts#L1).\n* 'message - A javascript object to be serealized into an IPP binary message.\n​\n​\n### Printer.getHeaders(headers?)\nReturns the heades to be included in your request\n​\n* 'headers' - The headers you want to add to the request.\n​\n​\n## Usage/Example\n#### Create a print request\n​\n```javascript\nimport axios from 'axios'\nimport PDFDocument from 'pdfkit'\nimport concat from 'concat-stream'\nimport Printer from './lib/printer'\n\nvar doc = new PDFDocument({ margin: 5 });\n\ndoc.pipe(concat(function (data: any) {\n\n    let url = \"http://192.168.4.62:631/ipp/print\"\n    let printer = new Printer(url);\n    let msg = {\n        \"operation-attributes-tag\": {\n            \"document-format\": \"application/pdf\",\n        },\n        data: data,\n    };\n\n    axios\n        .post(url, printer.encodeMsg(\"Print-Job\", msg), {\n            responseType:\"arraybuffer\",\n            headers: printer.getHeaders(),\n        })\n        .then((response:any) => {\n            console.log(printer.decodeMsg(response.data))\n        });\n\n\n}))\n​\n```\n​\n## License\n​\nMIT","readmeFilename":"README.md"}