@groupdocs/groupdocs.merger 24.2.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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>GroupDocs - End User License Agreement (EULA)</title>
|
|
4
|
+
<meta http-equiv="refresh" content="0; url=https://company.groupdocs.com/legal/eula" />
|
|
5
|
+
</head>
|
|
6
|
+
<body>
|
|
7
|
+
<p>Please wait. You'll be redirected to the online version of EULA.</p>
|
|
8
|
+
<p>If it fails to redirect then please go the following link manually: <a href="https://company.groupdocs.com/legal/eula">https://company.groupdocs.com/legal/eula</a></p>
|
|
9
|
+
</body>
|
|
10
|
+
</html>
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Document Merger API for Node.js
|
|
2
|
+
|
|
3
|
+
GroupDocs.Merger for-Node.js-via-Java is a [Document Merger API](https://products.groupdocs.com/merger/java) for Java developers. It supports over 60 document types from popular categories such as PDF, Microsoft Office, OpenOffice, Visio, images, audio, archives etc.
|
|
4
|
+
|
|
5
|
+
It allows developers to merge several documents into one, split single document to multiple documents, reorder or replace document pages, change page orientation, manage document protection, render documents as images and more.
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a title="Download complete GroupDocs.Merger for Java source code" href="https://github.com/groupdocs-merger/GroupDocs.Merger-for-Java/archive/master.zip">
|
|
9
|
+
<img src="https://raw.github.com/AsposeExamples/java-examples-dashboard/master/images/downloadZip-Button-Large.png" />
|
|
10
|
+
</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
Directory | Description
|
|
14
|
+
--------- | -----------
|
|
15
|
+
[Examples](https://github.com/groupdocs-merger/GroupDocs.Merger-for-Node.js-via-Java/tree/master/Examples) | Node.js examples and sample documents for you to get started quickly.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Node.js Merger API Features
|
|
19
|
+
- Join two or more documents into one document, join specific pages or page ranges from several source documents into single resultant document.
|
|
20
|
+
- Split a source document to several resultant documents.
|
|
21
|
+
- Move page to another position within a document.
|
|
22
|
+
- Remove single page or a collection of specific page numbers from the source document.
|
|
23
|
+
- Rotate pages within document by setting rotation angle to 90,180 or 270 degrees.
|
|
24
|
+
- Swap two pages positions within the source document. The result is a new document where two pages have their positions exchanged.
|
|
25
|
+
- Extract specified page or page ranges from source document. The result is a new document that contains only specified pages from the source document.
|
|
26
|
+
- Change orientation operation lets to set page orientation (portrait, landscape) for specific or all pages of the document.
|
|
27
|
+
- Manage document password protection: add/update/delete document password and check its existence.
|
|
28
|
+
- Get the basic information about source document - file type, size, pages count, page height and width etc.
|
|
29
|
+
- Document preview feature allows to generate image representations of document pages. This may be helpful for better understanding about document content and its structure. Preview can be generated for all document pages (by default) or for specific page numbers or page range.
|
|
30
|
+
|
|
31
|
+
## Supported File Formats
|
|
32
|
+
Merge documents of the [most popular file formats](https://docs.groupdocs.com/merger/nodejs-java/supported-document-formats/) (PDF, DOCX, XLSX, PPTX, JPG, ZIP and more) into single resultant document.
|
|
33
|
+
|
|
34
|
+
## Get Started with GroupDocs.Merger-for-Node.js-via-Java
|
|
35
|
+
|
|
36
|
+
GroupDocs.Merger-for-Node.js-via-Java requires J2SE 7.0 (1.7), J2SE 8.0 (1.8) or above. Please install Java first if you do not have it already.
|
|
37
|
+
|
|
38
|
+
GroupDocs hosts all Java APIs on [GroupDocs Artifact Repository](https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-merger/), so simply [configure](https://docs.groupdocs.com/merger/java/installation/) your Maven project to fetch the dependencies automatically.
|
|
39
|
+
|
|
40
|
+
### Installation
|
|
41
|
+
|
|
42
|
+
From the command line:
|
|
43
|
+
|
|
44
|
+
npm install @groupdocs/groupdocs.merger
|
|
45
|
+
|
|
46
|
+
### Run Examples
|
|
47
|
+
|
|
48
|
+
Change directory to Examples:
|
|
49
|
+
|
|
50
|
+
cd Examples
|
|
51
|
+
|
|
52
|
+
Run runExamles.js:
|
|
53
|
+
|
|
54
|
+
node runExamples.js
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Merge PDF using Node.js
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
// Load the source PDF file
|
|
61
|
+
const merger = new groupdocs.merger.Merger("sample1.pdf");
|
|
62
|
+
|
|
63
|
+
// Add another PDF file to merge
|
|
64
|
+
merger.join("sample2.pdf");
|
|
65
|
+
|
|
66
|
+
// Merge PDF files and save result
|
|
67
|
+
merger.save("merged.pdf");
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Load password protected DOCX via Node.js
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
// Load the password protected DOCX file
|
|
74
|
+
const loadOptions = new groupdocs.merger.LoadOptions("123");
|
|
75
|
+
const merger = new groupdocs.merger.Merger("sample.docx", loadOptions);
|
|
76
|
+
|
|
77
|
+
// Save the password protected DOCX result
|
|
78
|
+
merger.save("merged.docx");
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
[Home](https://www.groupdocs.com/) | [Product Page](https://products.groupdocs.com/merger/java) | [Documentation](https://docs.groupdocs.com/merger/java/) | [Demo](https://products.groupdocs.app/merger/family) | [API Reference](https://apireference.groupdocs.com/java/merger) | [Examples](https://github.com/groupdocs-merger/GroupDocs.Merger-for-Java/tree/master/Examples) | [Blog](https://blog.groupdocs.com/category/merger/) | [Search](https://search.groupdocs.com/) | [Free Support](https://forum.groupdocs.com/c/merger) | [Temporary License](https://purchase.groupdocs.com/temporary-license)
|
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
(() => {
|
|
5
|
+
function checkFileExists(filePath) {
|
|
6
|
+
try {
|
|
7
|
+
fs.accessSync(filePath, fs.constants.F_OK);
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!checkFileExists(path.join(__dirname, 'lib/groupdocs-merger-nodejs-24.2.jar'))) {
|
|
15
|
+
console.warn('\x1b[33m%s\x1b[0m', `File groupdocs-merger-nodejs-24.2.jar not found in the lib directory.\nPlease navigate to the package directory:`);
|
|
16
|
+
console.log('\n cd node_modules/@groupdocs/groupdocs.merger\n');
|
|
17
|
+
console.warn('\x1b[33m%s\x1b[0m', `Then download the JAR file using the command:`);
|
|
18
|
+
console.log('\n npm run postinstall\n');
|
|
19
|
+
process.exit(0)
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
module.exports = require("./lib/groupdocs.merger");
|
|
23
|
+
}
|
|
24
|
+
})()
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const java = require('java')
|
|
3
|
+
const os = require('os')
|
|
4
|
+
|
|
5
|
+
if (os.platform() === 'darwin') {
|
|
6
|
+
java.options.push('-Djava.awt.headless=true')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
java.asyncOptions = {
|
|
10
|
+
asyncSuffix: 'Async',
|
|
11
|
+
syncSuffix: '',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
java.classpath.push(path.join(__dirname, '/groupdocs-merger-nodejs-24.2.jar'))
|
|
15
|
+
|
|
16
|
+
exports = module.exports
|
|
17
|
+
|
|
18
|
+
function __typeof__(objClass) {
|
|
19
|
+
if (objClass !== undefined && objClass.constructor) {
|
|
20
|
+
const strFun = objClass.constructor.toString()
|
|
21
|
+
let className = strFun.substr(0, strFun.indexOf('('))
|
|
22
|
+
className = className.replace('function', '')
|
|
23
|
+
return className.replace(/(^\s*)|(\s*$)/gi, '')
|
|
24
|
+
}
|
|
25
|
+
return typeof objClass
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** STREAM HELPERS * */
|
|
29
|
+
exports.readDataFromStream = function (readStream, callback) {
|
|
30
|
+
const inputStreamBuffer = new exports.StreamBuffer()
|
|
31
|
+
readStream.on('data', chunk => {
|
|
32
|
+
inputStreamBuffer.write(chunk)
|
|
33
|
+
})
|
|
34
|
+
readStream.on('end', () => {
|
|
35
|
+
callback(inputStreamBuffer.toInputStream())
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.readBytesFromStream = function (readStream, callback) {
|
|
40
|
+
const inputStreamBuffer = new exports.StreamBuffer()
|
|
41
|
+
readStream.on('data', chunk => {
|
|
42
|
+
inputStreamBuffer.write(chunk)
|
|
43
|
+
})
|
|
44
|
+
readStream.on('end', () => {
|
|
45
|
+
const array = Array.from(inputStreamBuffer.toByteArray())
|
|
46
|
+
const javaArray = java.newArray('byte', array)
|
|
47
|
+
callback(javaArray)
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.ImageJoinMode = {
|
|
52
|
+
Horizontal : 0,
|
|
53
|
+
Vertical : 1,
|
|
54
|
+
},
|
|
55
|
+
exports.OrientationMode = {
|
|
56
|
+
Landscape : 1,
|
|
57
|
+
Portrait : 0,
|
|
58
|
+
},
|
|
59
|
+
exports.RangeMode = {
|
|
60
|
+
AllPages : 0,
|
|
61
|
+
EvenPages : 2,
|
|
62
|
+
OddPages : 1,
|
|
63
|
+
},
|
|
64
|
+
exports.RotateMode = {
|
|
65
|
+
Rotate180 : 180,
|
|
66
|
+
Rotate270 : 270,
|
|
67
|
+
Rotate90 : 90,
|
|
68
|
+
},
|
|
69
|
+
exports.SplitMode = {
|
|
70
|
+
Interval : 1,
|
|
71
|
+
Pages : 0,
|
|
72
|
+
},
|
|
73
|
+
exports.TextSplitMode = {
|
|
74
|
+
Interval : 1,
|
|
75
|
+
Lines : 0,
|
|
76
|
+
},
|
|
77
|
+
exports.WordJoinMode = {
|
|
78
|
+
Continuous : 1,
|
|
79
|
+
Default : 0,
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
exports.Merger = java.import("com.groupdocs.merger.Merger");
|
|
83
|
+
exports.MergerSettings = java.import("com.groupdocs.merger.MergerSettings");
|
|
84
|
+
exports.StreamBuffer = java.import("com.groupdocs.merger.contracts.StreamBuffer");
|
|
85
|
+
exports.PageBuilder = java.import("com.groupdocs.merger.domain.builders.PageBuilder");
|
|
86
|
+
exports.AddPasswordOptions = java.import("com.groupdocs.merger.domain.options.AddPasswordOptions");
|
|
87
|
+
exports.ExtractOptions = java.import("com.groupdocs.merger.domain.options.ExtractOptions");
|
|
88
|
+
exports.ImageJoinOptions = java.import("com.groupdocs.merger.domain.options.ImageJoinOptions");
|
|
89
|
+
exports.JoinOptions = java.import("com.groupdocs.merger.domain.options.JoinOptions");
|
|
90
|
+
exports.LoadOptions = java.import("com.groupdocs.merger.domain.options.LoadOptions");
|
|
91
|
+
exports.MoveOptions = java.import("com.groupdocs.merger.domain.options.MoveOptions");
|
|
92
|
+
exports.OleDiagramOptions = java.import("com.groupdocs.merger.domain.options.OleDiagramOptions");
|
|
93
|
+
exports.OlePresentationOptions = java.import("com.groupdocs.merger.domain.options.OlePresentationOptions");
|
|
94
|
+
exports.OleSpreadsheetOptions = java.import("com.groupdocs.merger.domain.options.OleSpreadsheetOptions");
|
|
95
|
+
exports.OleWordProcessingOptions = java.import("com.groupdocs.merger.domain.options.OleWordProcessingOptions");
|
|
96
|
+
exports.OrientationOptions = java.import("com.groupdocs.merger.domain.options.OrientationOptions");
|
|
97
|
+
exports.PageBuilderOptions = java.import("com.groupdocs.merger.domain.options.PageBuilderOptions");
|
|
98
|
+
exports.PageJoinOptions = java.import("com.groupdocs.merger.domain.options.PageJoinOptions");
|
|
99
|
+
exports.PdfAttachmentOptions = java.import("com.groupdocs.merger.domain.options.PdfAttachmentOptions");
|
|
100
|
+
exports.PreviewOptions = java.import("com.groupdocs.merger.domain.options.PreviewOptions");
|
|
101
|
+
exports.RemoveOptions = java.import("com.groupdocs.merger.domain.options.RemoveOptions");
|
|
102
|
+
exports.RotateOptions = java.import("com.groupdocs.merger.domain.options.RotateOptions");
|
|
103
|
+
exports.SaveOptions = java.import("com.groupdocs.merger.domain.options.SaveOptions");
|
|
104
|
+
exports.SplitOptions = java.import("com.groupdocs.merger.domain.options.SplitOptions");
|
|
105
|
+
exports.SwapOptions = java.import("com.groupdocs.merger.domain.options.SwapOptions");
|
|
106
|
+
exports.TextSplitOptions = java.import("com.groupdocs.merger.domain.options.TextSplitOptions");
|
|
107
|
+
exports.UpdatePasswordOptions = java.import("com.groupdocs.merger.domain.options.UpdatePasswordOptions");
|
|
108
|
+
exports.WordJoinOptions = java.import("com.groupdocs.merger.domain.options.WordJoinOptions");
|
|
109
|
+
exports.DocumentInfo = java.import("com.groupdocs.merger.domain.result.DocumentInfo");
|
|
110
|
+
exports.PageInfo = java.import("com.groupdocs.merger.domain.result.PageInfo");
|
|
111
|
+
exports.ArgumentNullException = java.import("com.groupdocs.merger.exception.ArgumentNullException");
|
|
112
|
+
exports.GroupDocsException = java.import("com.groupdocs.merger.exception.GroupDocsException");
|
|
113
|
+
exports.InvalidOperationException = java.import("com.groupdocs.merger.exception.InvalidOperationException");
|
|
114
|
+
exports.LicenseException = java.import("com.groupdocs.merger.exception.LicenseException");
|
|
115
|
+
exports.FileCorruptedException = java.import("com.groupdocs.merger.exceptions.FileCorruptedException");
|
|
116
|
+
exports.FileTypeNotSupportedException = java.import("com.groupdocs.merger.exceptions.FileTypeNotSupportedException");
|
|
117
|
+
exports.GroupDocsMergerException = java.import("com.groupdocs.merger.exceptions.GroupDocsMergerException");
|
|
118
|
+
exports.IncorrectPasswordException = java.import("com.groupdocs.merger.exceptions.IncorrectPasswordException");
|
|
119
|
+
exports.PasswordRequiredException = java.import("com.groupdocs.merger.exceptions.PasswordRequiredException");
|
|
120
|
+
exports.License = java.import("com.groupdocs.merger.licensing.License");
|
|
121
|
+
exports.Metered = java.import("com.groupdocs.merger.licensing.metered.Metered");
|
|
122
|
+
exports.ConsoleLogger = java.import("com.groupdocs.merger.logging.ConsoleLogger");
|
|
123
|
+
exports.CultureInfo = java.import("com.groupdocs.merger.utils.CultureInfo");
|
|
124
|
+
|
|
125
|
+
exports.FileType = java.import("com.groupdocs.merger.domain.FileType");
|
|
126
|
+
exports.PreviewMode = java.import("com.groupdocs.merger.domain.options.PreviewMode");
|
|
127
|
+
exports.PathUtils = java.import("com.groupdocs.merger.utils.PathUtils");
|
|
128
|
+
exports.Path = java.import("com.groupdocs.merger.utils.common.Path");
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
exports.StreamBuffer = class StreamBuffer {
|
|
132
|
+
constructor() {
|
|
133
|
+
const self = java.newInstanceSync('com.groupdocs.merger.contracts.StreamBuffer')
|
|
134
|
+
|
|
135
|
+
self.write = function (chunk) {
|
|
136
|
+
const array = Array.from(chunk)
|
|
137
|
+
const javaArray = java.newArray('byte', array)
|
|
138
|
+
self.__proto__.write.call(self, javaArray, 0, javaArray.length)
|
|
139
|
+
}
|
|
140
|
+
return self
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** STREAM METHODS * */
|
|
145
|
+
exports.License.setLicenseFromStream = function (license, licenseStream, callback) {
|
|
146
|
+
const inputStreamBuffer = new exports.StreamBuffer()
|
|
147
|
+
licenseStream.on('data', chunk => {
|
|
148
|
+
inputStreamBuffer.write(chunk)
|
|
149
|
+
})
|
|
150
|
+
licenseStream.on('end', () => {
|
|
151
|
+
let error
|
|
152
|
+
try {
|
|
153
|
+
license.setLicense(inputStreamBuffer.toInputStream())
|
|
154
|
+
} catch (err) {
|
|
155
|
+
error = err
|
|
156
|
+
}
|
|
157
|
+
callback(error)
|
|
158
|
+
})
|
|
159
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@groupdocs/groupdocs.merger",
|
|
3
|
+
"version": "24.2.0",
|
|
4
|
+
"description": "GroupDocs.Merger for .NET allows you to merge documents and manipulate document structure across most of famous document types. Merge several documents into one, split single document to multiple documents, reorder or replace document pages, change page orientation and perform other manipulations with GroupDocs.Merger",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"lib": "lib"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "curl -H 'Cache-Control:no-cache' https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-merger-nodejs/24.2/groupdocs-merger-nodejs-24.2.jar > lib/groupdocs-merger-nodejs-24.2.jar"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://git.saltov.dynabic.com/groupdocs/alpha/merger/groupdocs.merger-for-node.js-via-java"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"GroupDocs.Merger",
|
|
18
|
+
"merger",
|
|
19
|
+
"merge",
|
|
20
|
+
"bmp",
|
|
21
|
+
"combine",
|
|
22
|
+
"csv",
|
|
23
|
+
"diagram",
|
|
24
|
+
"doc",
|
|
25
|
+
"document",
|
|
26
|
+
"docx",
|
|
27
|
+
"epub",
|
|
28
|
+
"excel",
|
|
29
|
+
"extract",
|
|
30
|
+
"file",
|
|
31
|
+
"frame",
|
|
32
|
+
"gif",
|
|
33
|
+
"html",
|
|
34
|
+
"image",
|
|
35
|
+
"join",
|
|
36
|
+
"jpeg",
|
|
37
|
+
"jpg",
|
|
38
|
+
"mhtml",
|
|
39
|
+
"note",
|
|
40
|
+
"odp",
|
|
41
|
+
"ods",
|
|
42
|
+
"one",
|
|
43
|
+
"orientation",
|
|
44
|
+
"otp",
|
|
45
|
+
"ott",
|
|
46
|
+
"page",
|
|
47
|
+
"pdf",
|
|
48
|
+
"png",
|
|
49
|
+
"powerpoint",
|
|
50
|
+
"pps",
|
|
51
|
+
"ppsx",
|
|
52
|
+
"ppt",
|
|
53
|
+
"pptx",
|
|
54
|
+
"presentation",
|
|
55
|
+
"remove",
|
|
56
|
+
"rotate",
|
|
57
|
+
"rtf",
|
|
58
|
+
"slide",
|
|
59
|
+
"splitter",
|
|
60
|
+
"split",
|
|
61
|
+
"spreadsheet",
|
|
62
|
+
"swap",
|
|
63
|
+
"tex",
|
|
64
|
+
"tif",
|
|
65
|
+
"tiff",
|
|
66
|
+
"total",
|
|
67
|
+
"tsv",
|
|
68
|
+
"txt",
|
|
69
|
+
"vdx",
|
|
70
|
+
"visio",
|
|
71
|
+
"vsdx",
|
|
72
|
+
"web",
|
|
73
|
+
"word",
|
|
74
|
+
"worksheet",
|
|
75
|
+
"xlam",
|
|
76
|
+
"xls",
|
|
77
|
+
"xlsb",
|
|
78
|
+
"xlsm",
|
|
79
|
+
"xlsx",
|
|
80
|
+
"xps",
|
|
81
|
+
"zip",
|
|
82
|
+
"tar",
|
|
83
|
+
"rar",
|
|
84
|
+
"7z",
|
|
85
|
+
"svg",
|
|
86
|
+
"svgz",
|
|
87
|
+
"wav",
|
|
88
|
+
"mp3"
|
|
89
|
+
],
|
|
90
|
+
"author": "Aspose",
|
|
91
|
+
"license": "End User License Agreement.html",
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"dotenv": "^16.4.5",
|
|
94
|
+
"java": "^0.14.0"
|
|
95
|
+
}
|
|
96
|
+
}
|