@timokunze/node-printer 0.6.7 → 0.6.8
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 +0 -18
- package/package.json +9 -9
- package/src/macros.hh +3 -5
- package/src/node_printer_posix.cc +3 -3
package/README.md
CHANGED
|
@@ -2,24 +2,6 @@ Node Printer Prebuild
|
|
|
2
2
|
============
|
|
3
3
|
Native bind printers on POSIX and Windows OS from Node.js, electron and node-webkit.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@timokunze/node-printer) [](https://github.com/TimoKunze/node-printer/actions/workflows/prebuild-main.yml)
|
|
6
|
-
|
|
7
|
-
> Me (TimoKunze) created this fork to upgrade dependencies since I ran into various issues with current versions of Node and Electron.
|
|
8
|
-
|
|
9
|
-
> It just works with Node 12 because of @thiagoelg in his [PR](https://github.com/tojocky/node-printer/pull/261)
|
|
10
|
-
|
|
11
|
-
> Prebuild and CI integration courtesy of @ekoeryanto in his [FORK](https://github.com/ekoeryanto/node-printer)
|
|
12
|
-
|
|
13
|
-
If you have a problem, ask question to [](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/TimoKunze/node-printer/issues)
|
|
14
|
-
|
|
15
|
-
___
|
|
16
|
-
### **Below is the original README**
|
|
17
|
-
___
|
|
18
|
-
### Reason:
|
|
19
|
-
|
|
20
|
-
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.
|
|
21
|
-
|
|
22
|
-
|
|
23
5
|
### Features:
|
|
24
6
|
|
|
25
7
|
* no dependecies;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timokunze/node-printer",
|
|
3
3
|
"description": "Node.js printer bindings",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.8",
|
|
5
5
|
"homepage": "https://github.com/TimoKunze/node-printer",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Ion Lupascu",
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "git://github.com/TimoKunze/node-printer.git"
|
|
19
19
|
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"node-gyp": "^10.1.0",
|
|
22
|
-
"prebuild": "^13.0.0",
|
|
23
|
-
"node-abi": "^3.62.0",
|
|
24
|
-
"patch-package": "^8.0.0"
|
|
25
|
-
},
|
|
26
20
|
"engines": {
|
|
27
21
|
"node": ">= 18.0.0"
|
|
28
22
|
},
|
|
@@ -45,9 +39,15 @@
|
|
|
45
39
|
}
|
|
46
40
|
],
|
|
47
41
|
"main": "./lib/printer",
|
|
42
|
+
"types": "types/index.d.ts",
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"node-gyp": "^10.1.0",
|
|
45
|
+
"prebuild": "^13.0.1",
|
|
46
|
+
"node-abi": "^3.63.0",
|
|
47
|
+
"patch-package": "^8.0.0"
|
|
48
|
+
},
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"nan": "^2.19.0",
|
|
50
51
|
"prebuild-install": "^7.1.2"
|
|
51
|
-
}
|
|
52
|
-
"types": "types/index.d.ts"
|
|
52
|
+
}
|
|
53
53
|
}
|
package/src/macros.hh
CHANGED
|
@@ -12,11 +12,6 @@
|
|
|
12
12
|
# define MY_NODE_MODULE_HANDLESCOPE MY_NODE_MODULE_ISOLATE_DECL Nan::HandleScope scope
|
|
13
13
|
# define V8_VALUE_NEW(type, value) v8::type::New(MY_NODE_MODULE_ISOLATE, value)
|
|
14
14
|
# define V8_VALUE_NEW_DEFAULT(type) v8::type::New(MY_NODE_MODULE_ISOLATE)
|
|
15
|
-
# if NODE_MODULE_VERSION > 73
|
|
16
|
-
# define V8_STRING_NEW_2BYTES(value) v8::String::NewFromTwoByte(MY_NODE_MODULE_ISOLATE, value).ToLocalChecked()
|
|
17
|
-
# else
|
|
18
|
-
# define V8_STRING_NEW_2BYTES(value) v8::String::NewFromTwoByte(MY_NODE_MODULE_ISOLATE, value)
|
|
19
|
-
# endif
|
|
20
15
|
|
|
21
16
|
# define RETURN_EXCEPTION(msg) isolate->ThrowException(Nan::Error(msg)); \
|
|
22
17
|
return
|
|
@@ -43,11 +38,14 @@
|
|
|
43
38
|
|
|
44
39
|
#if NODE_VERSION_AT_LEAST(4, 3, 0)
|
|
45
40
|
# define V8_STRING_NEW_UTF8(value) v8::String::NewFromUtf8(MY_NODE_MODULE_ISOLATE, value, v8::NewStringType::kNormal).ToLocalChecked()
|
|
41
|
+
# define V8_STRING_NEW_2BYTES(value) v8::String::NewFromTwoByte(MY_NODE_MODULE_ISOLATE, value, v8::NewStringType::kNormal).ToLocalChecked()
|
|
46
42
|
#elif NODE_VERSION_AT_LEAST(0, 11, 10)
|
|
47
43
|
# if NODE_MODULE_VERSION > 73
|
|
48
44
|
# define V8_STRING_NEW_UTF8(value) v8::String::NewFromUtf8(MY_NODE_MODULE_ISOLATE, value).ToLocalChecked()
|
|
45
|
+
# define V8_STRING_NEW_2BYTES(value) v8::String::NewFromTwoByte(MY_NODE_MODULE_ISOLATE, value).ToLocalChecked()
|
|
49
46
|
# else
|
|
50
47
|
# define V8_STRING_NEW_UTF8(value) v8::String::NewFromUtf8(MY_NODE_MODULE_ISOLATE, value)
|
|
48
|
+
# define V8_STRING_NEW_2BYTES(value) v8::String::NewFromTwoByte(MY_NODE_MODULE_ISOLATE, value)
|
|
51
49
|
# endif
|
|
52
50
|
#endif
|
|
53
51
|
|
|
@@ -310,14 +310,14 @@ MY_NODE_MODULE_CALLBACK(getDefaultPrinterName)
|
|
|
310
310
|
MY_NODE_MODULE_HANDLESCOPE;
|
|
311
311
|
//This does not return default user printer name according to https://www.cups.org/documentation.php/doc-2.0/api-cups.html#cupsGetDefault2
|
|
312
312
|
//so leave as undefined and JS implementation will loop in all printers
|
|
313
|
-
|
|
314
|
-
const char * printerName = cupsGetDefault();
|
|
313
|
+
|
|
314
|
+
const char * printerName = NULL; //cupsGetDefault();
|
|
315
315
|
|
|
316
316
|
// return default printer name only if defined
|
|
317
317
|
if(printerName != NULL) {
|
|
318
318
|
MY_NODE_MODULE_RETURN_VALUE(V8_STRING_NEW_UTF8(printerName));
|
|
319
319
|
}
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
MY_NODE_MODULE_RETURN_UNDEFINED();
|
|
322
322
|
}
|
|
323
323
|
|