node-printer
============
Native bind printers on POSIX and Windows OS from Node.js, iojs and node-webkit.
<table>
<thead>
<tr>
<th>Linux</th>
<th>Windows</th>
<th>Dependencies</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">
<a href="https://travis-ci.org/tojocky/node-printer"><img src="https://travis-ci.org/tojocky/node-printer.svg?branch=master"></a>
</td>
<td align="center">
<a href="https://ci.appveyor.com/project/tojocky/node-printer"><img src="https://ci.appveyor.com/api/projects/status/9y800f36wla35ee7?svg=true"></a>
</td>
<td align="center">
<a href="https://david-dm.org/tojocky/node-printer"><img src="https://david-dm.org/tojocky/node-printer.svg"></a>
</td>
</tr>
</tbody>
</table>
If you have a problem, ask question to [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tojocky/node-printer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) or find/create a new [Github issue](https://github.com/tojocky/node-printer/issues)
### Reason:
I was involved in a project where I need to print from Node.JS. This is the reason why I created this project and I want to share my code with others.
### Features:
* no dependecies;
* native method wrappers from Windows and POSIX (which uses [CUPS 1.4/MAC OS X 10.6](http://cups.org/)) APIs;
* compatible with node v0.8.x, 0.9.x and v0.11.x (with 0.11.9 and 0.11.13);
* compatible with node-webkit v0.8.x and 0.9.2;
* `getPrinters()` to enumerate all installed printers with current jobs and statuses;
* `getPrinter(printerName)` to get a specific/default printer info with current jobs and statuses;
* `getPrinterDriverOptions(printerName)` ([POSIX](http://en.wikipedia.org/wiki/POSIX) only) to get a specific/default printer driver options such as supported paper size and other info
* `getSelectedPaperSize(printerName)` ([POSIX](http://en.wikipedia.org/wiki/POSIX) only) to get a specific/default printer default paper size from its driver options
* `getDefaultPrinterName()` return the default printer name;
* `printDirect(options)` to send a job to a specific/default printer, now supports [CUPS options](https://www.cups.org/doc/options.html) passed in the form of a JS object (see `cancelJob.js` example). To print a PDF from windows it is possible by using [node-pdfium module](https://github.com/tojocky/node-pdfium) to convert a PDF format into EMF and after to send to printer as EMF;
* `printFile(options)` ([POSIX](http://en.wikipedia.org/wiki/POSIX) only) to print a file;
* `getSupportedPrintFormats()` to get all possible print formats for printDirect method which depends on OS. `RAW` and `TEXT` are supported from all OS-es;
* `getJob(printerName, jobId)` to get a specific job info including job status;
* `setJob(printerName, jobId, command)` to send a command to a job (e.g. `'CANCEL'` to cancel the job);
* `getSupportedJobCommands()` to get supported job commands for setJob() depends on OS. `'CANCEL'` command is supported from all OS-es.
### How to install:
Make sure you have Python 2.x installed on your system. Windows users will also require Visual Studio (2013 Express is a good fit)
from [npmjs.org](https://www.npmjs.org/package/printer)
#### Prebuilt node builds
```
npm install printer --target_arch=ia32
npm install printer --target_arch=x64
```
#### Prebuilt electron builds
Say you are installing 1.4.5 electron. Please check the [Releases](https://github.com/tojocky/node-printer/releases) for supported Electron versions
```
npm install printer --runtime=electron --target=1.4.5 --target_arch=x64
npm install printer --runtime=electron --target=1.4.5 --target_arch=ia32
```
#### For building after install
```
npm install -g node-gyp
npm install printer --msvs_version=2013 --build-from-source=node_printer
```
or [direct from git](https://www.npmjs.org/doc/cli/npm-install.html):
npm install git+https://github.com/tojocky/node-printer.git
if you want to to run in [nwjs](http://nwjs.io/) then rebuild the module with [nw-gyp](https://github.com/nwjs/nw-gyp):
```
npm install -g nw-gyp
cd node_modules/printer
nw-gyp rebuild
```
For specific distribution `--dist-url` node-gyp parameter should be used. Example for electron:
```
node-gyp rebuild --target=0.37.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell
```
Ubuntu User :
You need to install libcups2-dev package
`sudo apt-get install libcups2-dev`
### How to use:
See [examples](https://github.com/tojocky/node-printer/tree/master/examples)
### Author(s):
* Ion Lupascu, ionlupascu@gmail.com
### Contibutors:
Feel free to download, test and propose new futures
### License:
[The MIT License (MIT)](http://opensource.org/licenses/MIT)
没有合适的资源?快使用搜索试试~ 我知道了~
node-printer:本机node.js打印机
共34个文件
js:16个
cc:3个
yml:2个
5星 · 超过95%的资源 需积分: 46 20 下载量 88 浏览量
2021-02-22
18:42:10
上传
评论
收藏 113KB ZIP 举报
温馨提示
节点打印机 通过Node.js,iojs和node-webkit在POSIX和Windows操作系统上的本机绑定打印机。 Linux 视窗 依存关系 如果有问题,请提问 或查找/创建新的 原因: 我参与了一个需要从Node.JS打印的项目。 这就是为什么我创建此项目并希望与他人共享代码的原因。 特征: 没有依赖 Windows和POSIX(使用 )API的本机方法包装器; 与节点v0.8.x,0.9.x和v0.11.x兼容(具有0.11.9和0.11.13); 与node-webkit v0.8.x和0.9.2兼容; getPrinters()枚举具有当前作业和状态的所有已安装打印机; getPrinter(printerName)获取具有当前作业和状态的特定/默认打印机信息; getPrinterDriverOptions(printerName) (仅适用于 )以获
资源详情
资源评论
资源推荐
收起资源包目录
node-printer-master.zip (34个子文件)
node-printer-master
.gitignore 78B
package.json 1KB
src
node_printer.cc 1KB
node_printer_posix.cc 18KB
macros.hh 9KB
node_printer.hpp 3KB
node_printer_win.cc 30KB
.travis.yml 2KB
Gruntfile.js 2KB
ChangeLog 1KB
printer.js 42B
tools
buildElectronWindows.ps1 818B
buildWindows.ps1 895B
buildElectronLinux.sh 578B
getSourceFiles.py 338B
examples
getPrinterDriverOptions.js 398B
test.pdf 85KB
getSupportedJobCommands.js 198B
getPrinters.js 160B
example_zebra_printer.js 437B
cancelJob.js 1KB
print_raw.js 433B
getSupportedFormats.js 176B
printFile.js 925B
printPDFFileInBuffer.js 1KB
printPDFInWindows.js 1KB
getDefaultPrinterName.js 147B
README.md 5KB
appveyor.yml 2KB
lib
index.js 38B
printer.js 9KB
binding.gyp 2KB
.npmignore 29B
test
getPrinters.js 297B
共 34 条
- 1
橘子乔JVZI
- 粉丝: 32
- 资源: 4579
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 此存储库适用于 Linkedin Learning 课程学习 Java.zip
- (源码)基于STM32和AD9850的无线电信标系统.zip
- (源码)基于Android的新闻推荐系统.zip
- 本资源库是关于“Java Collection Framework API”的参考资料,是 Java 开发社区的重要贡献,旨在提供有关 Java 语言学院 API 的实践示例和递归教育关系 .zip
- 插件: e2eFood.dll
- 打造最强的Java安全研究与安全开发面试题库,帮助师傅们找到满意的工作.zip
- (源码)基于Spark的实时用户行为分析系统.zip
- (源码)基于Spring Boot和Vue的个人博客后台管理系统.zip
- 将流行的 ruby faker gem 引入 Java.zip
- (源码)基于C#和ArcGIS Engine的房屋管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1