@luckykiet/node-printer 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,61 +1,85 @@
1
- Node Printer Prebuild
2
- ============
3
- Native bind printers on POSIX and Windows OS from Node.js, electron and node-webkit.
1
+ # @luckykiet/node-printer
4
2
 
5
- [![npm version](https://badge.fury.io/js/@thiagoelg%2Fnode-printer.svg)](https://www.npmjs.com/package/@thiagoelg/node-printer) [![Prebuild Binaries and Publish](https://github.com/thiagoelg/node-printer/actions/workflows/prebuild-main.yml/badge.svg)](https://github.com/thiagoelg/node-printer/actions/workflows/prebuild-main.yml)
3
+ Native printer bindings for Node.js on POSIX and Windows. Fork of [@thiagoelg/node-printer](https://github.com/thiagoelg/node-printer) with **Node 24+ support**.
6
4
 
7
- > It just works with Node 12 because of @thiagoelg in his [PR](https://github.com/tojocky/node-printer/pull/261)
5
+ [![npm version](https://badge.fury.io/js/@luckykiet%2Fnode-printer.svg)](https://www.npmjs.com/package/@luckykiet/node-printer)
8
6
 
9
- > Prebuild and CI integration courtesy of @ekoeryanto in his [FORK](https://github.com/ekoeryanto/node-printer)
7
+ ## What's different from the original?
10
8
 
11
- 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/thiagoelg/node-printer/issues)
9
+ - **Node 24/25 support** C++20 build, updated V8 compatibility
10
+ - Updated native dependencies (`nan` 2.25+, `node-abi` 4.26+)
11
+ - macOS arm64 (Apple Silicon) prebuild support
12
+ - Modernized GitHub Actions (v4, Node 24)
13
+ - Minimum Node version: **20.0.0**
12
14
 
13
- ___
14
- ### **Below is the original README**
15
- ___
16
- ### Reason:
15
+ ## Install
17
16
 
18
- 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.
19
-
20
-
21
- ### Features:
17
+ ```bash
18
+ npm install @luckykiet/node-printer
19
+ ```
22
20
 
23
- * no dependecies;
24
- * native method wrappers from Windows and POSIX (which uses [CUPS 1.4/MAC OS X 10.6](http://cups.org/)) APIs;
25
- * compatible with node v0.8.x, 0.9.x and v0.11.x (with 0.11.9 and 0.11.13);
26
- * compatible with node-webkit v0.8.x and 0.9.2;
27
- * `getPrinters()` to enumerate all installed printers with current jobs and statuses;
28
- * `getPrinter(printerName)` to get a specific/default printer info with current jobs and statuses;
29
- * `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
30
- * `getSelectedPaperSize(printerName)` ([POSIX](http://en.wikipedia.org/wiki/POSIX) only) to get a specific/default printer default paper size from its driver options
31
- * `getDefaultPrinterName()` return the default printer name;
32
- * `printDirect(options)` to send a job to a specific/default printer, now supports [CUPS options](http://www.cups.org/documentation.php/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;
33
- * `printFile(options)` ([POSIX](http://en.wikipedia.org/wiki/POSIX) only) to print a file;
34
- * `getSupportedPrintFormats()` to get all possible print formats for printDirect method which depends on OS. `RAW` and `TEXT` are supported from all OS-es;
35
- * `getJob(printerName, jobId)` to get a specific job info including job status;
36
- * `setJob(printerName, jobId, command)` to send a command to a job (e.g. `'CANCEL'` to cancel the job);
37
- * `getSupportedJobCommands()` to get supported job commands for setJob() depends on OS. `'CANCEL'` command is supported from all OS-es.
21
+ ### Build prerequisites
38
22
 
23
+ The native addon compiles from source if no prebuild is available.
39
24
 
40
- ### How to install:
25
+ **macOS:** Xcode Command Line Tools (ships with CUPS)
26
+ ```bash
27
+ xcode-select --install
41
28
  ```
42
- npm install @thiagoelg/node-printer
29
+
30
+ **Linux (Debian/Ubuntu):**
31
+ ```bash
32
+ sudo apt-get install libcups2-dev
43
33
  ```
44
34
 
45
- ### How to use:
35
+ **Windows:** Visual Studio Build Tools with C++ workload
46
36
 
47
- See [examples](https://github.com/thiagoelg/node-printer/tree/main/examples)
37
+ ## API
48
38
 
49
- ### Author(s):
39
+ ```js
40
+ const printer = require('@luckykiet/node-printer');
41
+ ```
42
+
43
+ | Method | Description |
44
+ |--------|-------------|
45
+ | `getPrinters()` | List all installed printers with jobs and statuses |
46
+ | `getPrinter(name)` | Get specific printer info |
47
+ | `getDefaultPrinterName()` | Get default printer name |
48
+ | `getPrinterDriverOptions(name)` | Get driver options (POSIX only) |
49
+ | `getSelectedPaperSize(name)` | Get default paper size (POSIX only) |
50
+ | `printDirect(options)` | Send raw data to printer |
51
+ | `printFile(options)` | Print a file (POSIX only) |
52
+ | `getSupportedPrintFormats()` | List supported formats (RAW, TEXT, PDF, etc.) |
53
+ | `getJob(printerName, jobId)` | Get job info |
54
+ | `setJob(printerName, jobId, command)` | Send command to job (e.g. CANCEL) |
55
+ | `getSupportedJobCommands()` | List supported job commands |
56
+
57
+ ## Examples
58
+
59
+ ```js
60
+ const printer = require('@luckykiet/node-printer');
61
+
62
+ // List printers
63
+ console.log(printer.getPrinters());
64
+
65
+ // Print raw text
66
+ printer.printDirect({
67
+ data: 'Hello from Node.js!',
68
+ printer: printer.getDefaultPrinterName(),
69
+ type: 'TEXT',
70
+ success: (jobId) => console.log('Job ID:', jobId),
71
+ error: (err) => console.error(err),
72
+ });
73
+ ```
50
74
 
51
- * Ion Lupascu, ionlupascu@gmail.com
75
+ See the [examples](./examples) directory for more usage patterns.
52
76
 
53
- ### Contibutors:
77
+ ## Credits
54
78
 
55
- * Thiago Lugli, @thiagoelg
56
- * Eko Eryanto, @ekoeryanto
79
+ - **Ion Lupascu** — original author ([tojocky/node-printer](https://github.com/tojocky/node-printer))
80
+ - **Thiago Lugli** ([@thiagoelg](https://github.com/thiagoelg)) — Node 12+ support & prebuild CI
81
+ - **Eko Eryanto** ([@ekoeryanto](https://github.com/ekoeryanto)) — prebuild integration
57
82
 
58
- Feel free to download, test and propose new futures
83
+ ## License
59
84
 
60
- ### License:
61
- [The MIT License (MIT)](http://opensource.org/licenses/MIT)
85
+ [MIT](http://opensource.org/licenses/MIT)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@luckykiet/node-printer",
3
3
  "description": "Node.js native printer bindings. Fork of @thiagoelg/node-printer with Node 24+ support.",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "homepage": "https://github.com/luckykiet/node-printer",
6
6
  "author": {
7
7
  "name": "Ion Lupascu",
@@ -11,7 +11,7 @@
11
11
  "contributors": [
12
12
  "Thiago Lugli <thiagoelg@gmail.com>",
13
13
  "Eko Eryanto <ekoeryanto@gmail.com>",
14
- "luckykiet"
14
+ "Tuan Kiet Nguyen <ngntuankiet@gmail.com>"
15
15
  ],
16
16
  "repository": {
17
17
  "type": "git",
Binary file