muhammara 2.6.0 → 3.1.0
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/CHANGELOG.md +78 -43
- package/PDFRStreamForBuffer.js +33 -31
- package/PDFRStreamForFile.js +32 -41
- package/PDFStreamForResponse.js +12 -19
- package/PDFWStreamForBuffer.js +16 -23
- package/PDFWStreamForFile.js +24 -37
- package/README.md +8 -1
- package/binding.gyp +14 -1
- package/muhammara.d.ts +172 -72
- package/muhammara.js +24 -21
- package/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md +3 -0
- package/node_modules/@mapbox/node-pre-gyp/README.md +1 -1
- package/node_modules/@mapbox/node-pre-gyp/package.json +5 -5
- package/node_modules/safe-buffer/package.json +1 -0
- package/node_modules/set-blocking/package.json +1 -2
- package/node_modules/string-width/package.json +4 -1
- package/node_modules/strip-ansi/package.json +3 -1
- package/package.json +12 -10
- package/src/AbstractContentContextDriver.cpp +104 -35
- package/src/deps/PDFWriter/CFFANSIFontWriter.cpp +1 -1
- package/src/deps/PDFWriter/ETokenSeparator.h +1 -1
- package/src/deps/PDFWriter/ObjectsContext.h +1 -1
- package/src/deps/PDFWriter/PDFDocumentHandler.cpp +2 -2
- package/src/deps/PDFWriter/PrimitiveObjectsWriter.h +1 -1
- package/src/muhammara.cpp +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,41 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.1.0] - 2022-09-30
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Update TypeScript declaration for `PDFStreamForResponse` to accept any writable stream as an argument, not just `PDFRStreamForFile`
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Node 18
|
|
19
|
+
- Electron 20.0, 20.1, 20.2
|
|
20
|
+
- Prettier as dev dependency and basics
|
|
21
|
+
- Electron 19.1
|
|
22
|
+
|
|
23
|
+
## [3.0.0] - 2022-07-19
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Links in docs
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- drawPath can now be used differently and this new way can be described with ts.
|
|
32
|
+
The old style is `drawPath(x1, y1, x2, y2..., options)` we now allow `drawPath([[x1, y1], [x2, y2]...], options)` too
|
|
33
|
+
- scn and SCN can now be used differently and this new way can be described with ts.
|
|
34
|
+
The old style is `scn(c1, c2, c3, c4, ..., 'patternName')` we now allow `scn([[c1, c2, c3, c4, ...], 'patternName')` too
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Bump dev dependency versions s
|
|
39
|
+
|
|
40
|
+
### Breaking
|
|
41
|
+
|
|
42
|
+
- Node < 11 and Electron < 11 removed
|
|
43
|
+
- Renamed typo exported value from eTokenSeprator to eTokenSeparator
|
|
44
|
+
|
|
10
45
|
## [2.6.0] - 2022-06-30
|
|
11
46
|
|
|
12
47
|
### Changed
|
|
@@ -69,7 +104,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
69
104
|
### Added
|
|
70
105
|
|
|
71
106
|
- Add Electron 13.3.0
|
|
72
|
-
- Documentation (copy of
|
|
107
|
+
- Documentation (copy of the wiki)
|
|
73
108
|
- Add Electron 13.2.3
|
|
74
109
|
- Add Electron 13.5.0
|
|
75
110
|
- Add Electron 14.0.1
|
|
@@ -93,8 +128,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
93
128
|
|
|
94
129
|
### Fixed
|
|
95
130
|
|
|
96
|
-
|
|
97
|
-
|
|
131
|
+
- Yarn v2 incompatibiliy
|
|
132
|
+
- Build issues on mac OS big sur
|
|
98
133
|
|
|
99
134
|
## [1.8.0] - 2021-05-28
|
|
100
135
|
|
|
@@ -109,56 +144,56 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
109
144
|
|
|
110
145
|
### Added
|
|
111
146
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
147
|
+
- More electron 11.x releases
|
|
148
|
+
- Add electron 12.0.0
|
|
149
|
+
- Add electron 10.2, 10.3
|
|
150
|
+
- Add electron 9.4, 9.3
|
|
116
151
|
|
|
117
152
|
## [1.6.0] - 2021-02-17
|
|
118
153
|
|
|
119
154
|
### Fixed
|
|
120
155
|
|
|
121
|
-
|
|
122
|
-
|
|
156
|
+
- Update the g++ compiler from 4.8 to 5.4 (default on xenial) for linux builds
|
|
157
|
+
- Changed builds from travis and app veyor to github
|
|
123
158
|
|
|
124
159
|
### Added
|
|
125
160
|
|
|
126
|
-
|
|
127
|
-
|
|
161
|
+
- Electron 11
|
|
162
|
+
- Added Node 15
|
|
128
163
|
|
|
129
164
|
## [1.5.1] - 2020-10-10
|
|
130
165
|
|
|
131
166
|
### Added
|
|
132
167
|
|
|
133
|
-
|
|
168
|
+
- Added manual workflow to reduce release errors
|
|
134
169
|
|
|
135
170
|
### Fixed
|
|
136
171
|
|
|
137
|
-
|
|
172
|
+
- Huge package size as npm publish does not use .gitignore or .npmignore locally
|
|
138
173
|
|
|
139
174
|
## [1.5.0] - 2020-10-10
|
|
140
175
|
|
|
141
176
|
### Added
|
|
142
177
|
|
|
143
|
-
|
|
178
|
+
- Electron 7.3, 8.3, 8.4, 8.5 and 9.3
|
|
144
179
|
|
|
145
180
|
## [1.4.3] - 2020-10-09
|
|
146
181
|
|
|
147
182
|
### Fixed
|
|
148
183
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
184
|
+
- Return code fixed for builds on app veyor.
|
|
185
|
+
- Winwdows builds successfully with electron 10.x
|
|
186
|
+
- NPM version on app veyor fixed to build electron 2.x again
|
|
152
187
|
|
|
153
188
|
### Added
|
|
154
189
|
|
|
155
|
-
|
|
190
|
+
- Add electron 10.1.3
|
|
156
191
|
|
|
157
192
|
## [1.4.2] - 2020-08-27
|
|
158
193
|
|
|
159
194
|
### Added
|
|
160
195
|
|
|
161
|
-
|
|
196
|
+
- Add electron 10.0
|
|
162
197
|
|
|
163
198
|
## [1.4.1] - 2020-08-13
|
|
164
199
|
|
|
@@ -168,56 +203,55 @@ debug output.
|
|
|
168
203
|
|
|
169
204
|
### Fixed
|
|
170
205
|
|
|
171
|
-
|
|
172
|
-
|
|
206
|
+
- Removed debug output from packaged dependency `node-pre-gyp`
|
|
173
207
|
|
|
174
208
|
## [1.4.0] - 2020-08-10
|
|
175
209
|
|
|
176
210
|
### Added
|
|
177
211
|
|
|
178
|
-
|
|
212
|
+
- Add electron 9.2
|
|
179
213
|
|
|
180
214
|
## [1.3.0] - 2020-08-06
|
|
181
215
|
|
|
182
216
|
### Added
|
|
183
217
|
|
|
184
|
-
|
|
218
|
+
- Add electron-9.1 pre built
|
|
185
219
|
|
|
186
220
|
### Fixed
|
|
187
221
|
|
|
188
|
-
|
|
222
|
+
- Add missing typescript declaration files to published packages
|
|
189
223
|
|
|
190
224
|
## [1.2.0] - 2020-06-01
|
|
191
225
|
|
|
192
226
|
### Fixed
|
|
193
227
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
228
|
+
- Updated freetype to 2.10.0
|
|
229
|
+
- Updated libpng dependency to 1.6.37
|
|
230
|
+
- Updated libaesgm dependency
|
|
231
|
+
- Update libjpeg dependency to 9d
|
|
232
|
+
- Updated libtiff dependency to 3.9.7
|
|
199
233
|
|
|
200
234
|
## [1.1.0] - 2020-05-27
|
|
201
235
|
|
|
202
236
|
### Added
|
|
203
237
|
|
|
204
|
-
|
|
205
|
-
|
|
238
|
+
- Added infos about being hummusjs drop in replacement
|
|
239
|
+
- Added electron v9.0.0
|
|
206
240
|
|
|
207
241
|
### Fixed
|
|
208
242
|
|
|
209
|
-
|
|
243
|
+
- Updated dependencies and dev dependencies
|
|
210
244
|
|
|
211
245
|
## [1.0.1] - 2020-05-08
|
|
212
246
|
|
|
213
247
|
### Fixed
|
|
214
248
|
|
|
215
|
-
|
|
216
|
-
|
|
249
|
+
- Fixed readme to include infos about muhammaraJS and hummus
|
|
250
|
+
- Fixed node-pre-gyp binary download links
|
|
217
251
|
|
|
218
252
|
### Removed
|
|
219
253
|
|
|
220
|
-
|
|
254
|
+
- Unecessary dependency on aws-sdk
|
|
221
255
|
|
|
222
256
|
## [1.0.0] - 2020-05-07
|
|
223
257
|
|
|
@@ -226,22 +260,23 @@ with the following changes.
|
|
|
226
260
|
|
|
227
261
|
### Added
|
|
228
262
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
263
|
+
- Store releases @github
|
|
264
|
+
- Listen for tags instead of a commit message
|
|
265
|
+
- Added node v13, v14, electron 6.1, 7.1, 7.2, 8.0, 8.1, 8.2
|
|
232
266
|
|
|
233
267
|
### Fixed
|
|
234
268
|
|
|
235
|
-
|
|
269
|
+
- Updated v8:GET / v8:SET calls which are incompatible with newer node version (>13)
|
|
236
270
|
|
|
237
271
|
### Removed
|
|
238
272
|
|
|
239
|
-
|
|
240
|
-
|
|
273
|
+
- Dropped support for electron 1.8
|
|
241
274
|
|
|
242
|
-
|
|
275
|
+
- Initial release
|
|
243
276
|
|
|
244
|
-
[
|
|
277
|
+
[unreleased]: https://github.com/julianhille/MuhammaraJS/compare/3.1.0...HEAD
|
|
278
|
+
[3.1.0]: https://github.com/julianhille/MuhammaraJS/compare/3.0.0...3.1.0
|
|
279
|
+
[3.0.0]: https://github.com/julianhille/MuhammaraJS/compare/2.6.0...3.0.0
|
|
245
280
|
[2.6.0]: https://github.com/julianhille/MuhammaraJS/compare/2.5.0...2.6.0
|
|
246
281
|
[2.5.0]: https://github.com/julianhille/MuhammaraJS/compare/2.4.0...2.5.0
|
|
247
282
|
[2.4.0]: https://github.com/julianhille/MuhammaraJS/compare/2.3.0...2.4.0
|
package/PDFRStreamForBuffer.js
CHANGED
|
@@ -4,38 +4,40 @@
|
|
|
4
4
|
@author Luciano Júnior
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
function PDFRStreamForBuffer(buffer){
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
PDFRStreamForBuffer.prototype.read = function(inAmount){
|
|
14
|
-
var amountToRead = inAmount;
|
|
15
|
-
var arr = this.innerArray.slice(this.rposition,this.rposition+amountToRead);
|
|
16
|
-
this.rposition += amountToRead;
|
|
17
|
-
return arr;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
PDFRStreamForBuffer.prototype.notEnded = function(){
|
|
21
|
-
return this.rposition < this.fileSize;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
PDFRStreamForBuffer.prototype.setPosition = function(inPosition){
|
|
25
|
-
this.rposition = inPosition;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
PDFRStreamForBuffer.prototype.setPositionFromEnd = function(inPosition){
|
|
29
|
-
this.rposition = this.fileSize-inPosition;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
PDFRStreamForBuffer.prototype.skip = function(inAmount){
|
|
33
|
-
this.rposition += inAmount;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
PDFRStreamForBuffer.prototype.getCurrentPosition = function(){
|
|
37
|
-
return this.rposition;
|
|
7
|
+
function PDFRStreamForBuffer(buffer) {
|
|
8
|
+
this.innerArray = Array.prototype.slice.call(buffer, 0);
|
|
9
|
+
this.rposition = 0;
|
|
10
|
+
this.fileSize = this.innerArray.length;
|
|
38
11
|
}
|
|
39
12
|
|
|
13
|
+
PDFRStreamForBuffer.prototype.read = function (inAmount) {
|
|
14
|
+
var amountToRead = inAmount;
|
|
15
|
+
var arr = this.innerArray.slice(
|
|
16
|
+
this.rposition,
|
|
17
|
+
this.rposition + amountToRead
|
|
18
|
+
);
|
|
19
|
+
this.rposition += amountToRead;
|
|
20
|
+
return arr;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
PDFRStreamForBuffer.prototype.notEnded = function () {
|
|
24
|
+
return this.rposition < this.fileSize;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
PDFRStreamForBuffer.prototype.setPosition = function (inPosition) {
|
|
28
|
+
this.rposition = inPosition;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
PDFRStreamForBuffer.prototype.setPositionFromEnd = function (inPosition) {
|
|
32
|
+
this.rposition = this.fileSize - inPosition;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
PDFRStreamForBuffer.prototype.skip = function (inAmount) {
|
|
36
|
+
this.rposition += inAmount;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
PDFRStreamForBuffer.prototype.getCurrentPosition = function () {
|
|
40
|
+
return this.rposition;
|
|
41
|
+
};
|
|
40
42
|
|
|
41
43
|
module.exports = PDFRStreamForBuffer;
|
package/PDFRStreamForFile.js
CHANGED
|
@@ -1,58 +1,49 @@
|
|
|
1
|
-
var fs = require(
|
|
1
|
+
var fs = require("fs");
|
|
2
2
|
/*
|
|
3
3
|
PDFRStreamForFile is an implementation of a read stream using the supplied file path.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
function PDFRStreamForFile(inPath)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.fileSize = fs.statSync(inPath)["size"];
|
|
6
|
+
function PDFRStreamForFile(inPath) {
|
|
7
|
+
this.rs = fs.openSync(inPath, "r");
|
|
8
|
+
this.path = inPath;
|
|
9
|
+
this.rposition = 0;
|
|
10
|
+
this.fileSize = fs.statSync(inPath)["size"];
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
PDFRStreamForFile.prototype.read = function(inAmount)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var arr = [];
|
|
13
|
+
PDFRStreamForFile.prototype.read = function (inAmount) {
|
|
14
|
+
var buffer = new Buffer(inAmount * 2);
|
|
15
|
+
var bytesRead = fs.readSync(this.rs, buffer, 0, inAmount, this.rposition);
|
|
16
|
+
var arr = [];
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
18
|
+
for (var i = 0; i < bytesRead; ++i) arr.push(buffer[i]);
|
|
19
|
+
this.rposition += bytesRead;
|
|
20
|
+
return arr;
|
|
21
|
+
};
|
|
25
22
|
|
|
26
|
-
PDFRStreamForFile.prototype.notEnded = function()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
23
|
+
PDFRStreamForFile.prototype.notEnded = function () {
|
|
24
|
+
return this.rposition < this.fileSize;
|
|
25
|
+
};
|
|
30
26
|
|
|
31
|
-
PDFRStreamForFile.prototype.setPosition = function(inPosition)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
27
|
+
PDFRStreamForFile.prototype.setPosition = function (inPosition) {
|
|
28
|
+
this.rposition = inPosition;
|
|
29
|
+
};
|
|
35
30
|
|
|
36
|
-
PDFRStreamForFile.prototype.setPositionFromEnd = function(inPosition)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
31
|
+
PDFRStreamForFile.prototype.setPositionFromEnd = function (inPosition) {
|
|
32
|
+
this.rposition = this.fileSize - inPosition;
|
|
33
|
+
};
|
|
40
34
|
|
|
41
|
-
PDFRStreamForFile.prototype.skip = function(inAmount)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
35
|
+
PDFRStreamForFile.prototype.skip = function (inAmount) {
|
|
36
|
+
this.rposition += inAmount;
|
|
37
|
+
};
|
|
45
38
|
|
|
46
|
-
PDFRStreamForFile.prototype.getCurrentPosition = function()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
39
|
+
PDFRStreamForFile.prototype.getCurrentPosition = function () {
|
|
40
|
+
return this.rposition;
|
|
41
|
+
};
|
|
50
42
|
|
|
51
43
|
function noop() {}
|
|
52
44
|
|
|
53
|
-
PDFRStreamForFile.prototype.close = function(inCallback)
|
|
54
|
-
|
|
55
|
-
fs.close(this.rs,inCallback ? inCallback : noop);
|
|
45
|
+
PDFRStreamForFile.prototype.close = function (inCallback) {
|
|
46
|
+
fs.close(this.rs, inCallback ? inCallback : noop);
|
|
56
47
|
};
|
|
57
48
|
|
|
58
|
-
module.exports = PDFRStreamForFile;
|
|
49
|
+
module.exports = PDFRStreamForFile;
|
package/PDFStreamForResponse.js
CHANGED
|
@@ -2,28 +2,21 @@
|
|
|
2
2
|
PDFStreamForResponse is an implementation of a write stream that writes directly to an HTTP response.
|
|
3
3
|
Using this stream frees the user from having to create a PDF file on disk when generating on-demand PDFs
|
|
4
4
|
*/
|
|
5
|
-
function PDFStreamForResponse(inResponse)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.position = 0;
|
|
5
|
+
function PDFStreamForResponse(inResponse) {
|
|
6
|
+
this.response = inResponse;
|
|
7
|
+
this.position = 0;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
PDFStreamForResponse.prototype.write = function(inBytesArray)
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return inBytesArray.length;
|
|
18
|
-
}
|
|
19
|
-
else
|
|
20
|
-
return 0;
|
|
10
|
+
PDFStreamForResponse.prototype.write = function (inBytesArray) {
|
|
11
|
+
if (inBytesArray.length > 0) {
|
|
12
|
+
this.response.write(new Buffer(inBytesArray));
|
|
13
|
+
this.position += inBytesArray.length;
|
|
14
|
+
return inBytesArray.length;
|
|
15
|
+
} else return 0;
|
|
21
16
|
};
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
return this.position;
|
|
18
|
+
PDFStreamForResponse.prototype.getCurrentPosition = function () {
|
|
19
|
+
return this.position;
|
|
27
20
|
};
|
|
28
21
|
|
|
29
|
-
module.exports = PDFStreamForResponse;
|
|
22
|
+
module.exports = PDFStreamForResponse;
|
package/PDFWStreamForBuffer.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
function PDFWStreamForBuffer()
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
this.position = 0;
|
|
1
|
+
function PDFWStreamForBuffer() {
|
|
2
|
+
this.buffer = null;
|
|
3
|
+
this.position = 0;
|
|
5
4
|
}
|
|
6
5
|
|
|
7
|
-
PDFWStreamForBuffer.prototype.write = function(inBytesArray)
|
|
8
|
-
{
|
|
9
|
-
if(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.buffer = Buffer.from(inBytesArray);
|
|
14
|
-
}
|
|
15
|
-
else
|
|
16
|
-
{
|
|
17
|
-
this.buffer = Buffer.concat([this.buffer, Buffer.from(inBytesArray)]);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.position += inBytesArray.length;
|
|
21
|
-
return inBytesArray.length;
|
|
6
|
+
PDFWStreamForBuffer.prototype.write = function (inBytesArray) {
|
|
7
|
+
if (inBytesArray.length > 0) {
|
|
8
|
+
if (!this.buffer) {
|
|
9
|
+
this.buffer = Buffer.from(inBytesArray);
|
|
10
|
+
} else {
|
|
11
|
+
this.buffer = Buffer.concat([this.buffer, Buffer.from(inBytesArray)]);
|
|
22
12
|
}
|
|
23
13
|
|
|
24
|
-
|
|
14
|
+
this.position += inBytesArray.length;
|
|
15
|
+
return inBytesArray.length;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return 0;
|
|
25
19
|
};
|
|
26
20
|
|
|
27
|
-
PDFWStreamForBuffer.prototype.getCurrentPosition = function()
|
|
28
|
-
|
|
29
|
-
return this.position;
|
|
21
|
+
PDFWStreamForBuffer.prototype.getCurrentPosition = function () {
|
|
22
|
+
return this.position;
|
|
30
23
|
};
|
|
31
24
|
|
|
32
25
|
module.exports = PDFWStreamForBuffer;
|
package/PDFWStreamForFile.js
CHANGED
|
@@ -1,51 +1,38 @@
|
|
|
1
|
-
var fs = require(
|
|
1
|
+
var fs = require("fs");
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
PDFWStreamForFile is an implementation of a write stream using the supplied file path.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
function PDFWStreamForFile(inPath)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.path = inPath;
|
|
7
|
+
function PDFWStreamForFile(inPath) {
|
|
8
|
+
this.ws = fs.createWriteStream(inPath);
|
|
9
|
+
this.position = 0;
|
|
10
|
+
this.path = inPath;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
PDFWStreamForFile.prototype.write = function(inBytesArray)
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return inBytesArray.length;
|
|
21
|
-
}
|
|
22
|
-
else
|
|
23
|
-
return 0;
|
|
13
|
+
PDFWStreamForFile.prototype.write = function (inBytesArray) {
|
|
14
|
+
if (inBytesArray.length > 0) {
|
|
15
|
+
this.ws.write(new Buffer(inBytesArray));
|
|
16
|
+
this.position += inBytesArray.length;
|
|
17
|
+
return inBytesArray.length;
|
|
18
|
+
} else return 0;
|
|
24
19
|
};
|
|
25
20
|
|
|
26
|
-
PDFWStreamForFile.prototype.getCurrentPosition = function()
|
|
27
|
-
|
|
28
|
-
return this.position;
|
|
21
|
+
PDFWStreamForFile.prototype.getCurrentPosition = function () {
|
|
22
|
+
return this.position;
|
|
29
23
|
};
|
|
30
24
|
|
|
31
|
-
PDFWStreamForFile.prototype.close = function(inCallback)
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
var self = this;
|
|
25
|
+
PDFWStreamForFile.prototype.close = function (inCallback) {
|
|
26
|
+
if (this.ws) {
|
|
27
|
+
var self = this;
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else
|
|
45
|
-
{
|
|
46
|
-
if(inCallback)
|
|
47
|
-
inCallback();
|
|
48
|
-
}
|
|
29
|
+
this.ws.end(function () {
|
|
30
|
+
self.ws = null;
|
|
31
|
+
if (inCallback) inCallback();
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
if (inCallback) inCallback();
|
|
35
|
+
}
|
|
49
36
|
};
|
|
50
37
|
|
|
51
|
-
module.exports = PDFWStreamForFile;
|
|
38
|
+
module.exports = PDFWStreamForFile;
|
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Welcome to MuhammaraJS
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.org/package/muhammara)
|
|
3
4
|
[](https://github.com/julianhille/MuhammaraJS/actions/workflows/build.yml)
|
|
4
5
|
|
|
@@ -11,7 +12,6 @@ hummusJS github wiki: available [here](https://github.com/galkahana/HummusJS/wik
|
|
|
11
12
|
Welcome to HummusJS.
|
|
12
13
|
A Fast NodeJS Module for Creating, Parsing an Manipulating PDF Files and Streams.
|
|
13
14
|
|
|
14
|
-
|
|
15
15
|
Original Project
|
|
16
16
|
Project site is [here](http://www.pdfhummus.com).
|
|
17
17
|
|
|
@@ -22,6 +22,13 @@ If you are looking for a C++ Library go [here](https://github.com/galkahana/PDF-
|
|
|
22
22
|
Version 2.0 will be incompatible with some older node and
|
|
23
23
|
electron versions because we needed to upgrade node-pre-gyp.
|
|
24
24
|
|
|
25
|
+
Version 3.x has breaking changes:
|
|
26
|
+
|
|
27
|
+
- Node < 11 and Electron < 11 removed the prebuilts
|
|
28
|
+
- Renamed typo exported value from eTokenSeprator to eTokenSeparator
|
|
29
|
+
|
|
30
|
+
This wont affect alot of you but still.
|
|
31
|
+
|
|
25
32
|
# Installation
|
|
26
33
|
|
|
27
34
|
```
|
package/binding.gyp
CHANGED
|
@@ -7,15 +7,28 @@
|
|
|
7
7
|
'dependencies': [
|
|
8
8
|
'./src/deps/PDFWriter/binding.gyp:pdfwriter'
|
|
9
9
|
],
|
|
10
|
+
"cflags_cc": [ "-std=c++17" ],
|
|
11
|
+
"cflags": [ "-std=c++17" ],
|
|
10
12
|
'include_dirs': [
|
|
11
13
|
'./src',
|
|
12
14
|
'./src/deps/PDFWriter',
|
|
13
15
|
'./src/deps/FreeType/include'
|
|
14
16
|
],
|
|
17
|
+
'msvs-settings':
|
|
18
|
+
{
|
|
19
|
+
'VCCLCompilerTool':
|
|
20
|
+
{
|
|
21
|
+
'AdditionalOptions':
|
|
22
|
+
[
|
|
23
|
+
'-std:c++17',
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
15
27
|
'conditions': [
|
|
16
28
|
['OS=="mac"', {
|
|
17
29
|
'xcode_settings': {
|
|
18
|
-
'CLANG_CXX_LIBRARY': 'libc++'
|
|
30
|
+
'CLANG_CXX_LIBRARY': 'libc++',
|
|
31
|
+
"OTHER_CFLAGS": [ "-std=c++17"]
|
|
19
32
|
}
|
|
20
33
|
}],
|
|
21
34
|
['OS=="win"', {
|