@pdftron/pdfnet-node 9.5.0-1 → 9.5.0-3-beta

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/package.json CHANGED
@@ -1,29 +1,20 @@
1
1
  {
2
2
  "name": "@pdftron/pdfnet-node",
3
- "version": "9.5.0-1",
3
+ "version": "9.5.0-3-beta",
4
4
  "main": "./lib/pdfnet.js",
5
5
  "types": "./lib/types.d.ts",
6
- "binary": {
7
- "module_name": "pdfnet-addon",
8
- "module_path": "./",
9
- "remote_path": "./downloads/PDFNetNode/{version}",
10
- "package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
11
- "host": "https://www.pdftron.com"
12
- },
13
6
  "scripts": {
14
- "install": "node-pre-gyp install --fallback-to-build=false"
7
+ "install": "node scripts/install.js"
15
8
  },
16
- "engines" : { "node" : ">=8 <19" },
17
- "description": "This is the PDFTron SDK packaged as a Node.js module.",
18
- "author": "PDFTron Systems Inc.",
9
+ "engines" : { "node" : ">=10 <=24" },
10
+ "description": "This is the Apryse SDK packaged as a Node.js module.",
11
+ "author": "Apryse Software Inc.",
19
12
  "license": "Commercial",
20
- "homepage": "https://www.pdftron.com",
21
- "bundledDependencies": [
22
- "underscore",
23
- "xhr2"
24
- ],
13
+ "homepage": "https://www.apryse.com",
25
14
  "dependencies": {
26
- "@mapbox/node-pre-gyp": "^1.0.3"
15
+ "underscore": "^1.13.6",
16
+ "xhr2": "^0.2.1",
17
+ "prebuild-install": "^7.1.3"
27
18
  },
28
19
  "keywords": ["PDF", "Office", "SDK"]
29
20
  }
package/readme.md CHANGED
@@ -1,12 +1,12 @@
1
1
  ## @pdftron/pdfnet-node
2
2
 
3
- This package leverages the full power of PDFTron's native SDK for maximal performance and accuracy. In order to maintain consistency across platforms the Javascript API is used in the same manner as the PDFNet API available in PDFTron's Web platform. Since access to the filesystem is included in Node.js/Electron some additional APIs requiring filesystem access have also been included.
3
+ This package leverages the full power of Apryse's native SDK for maximal performance and accuracy. In order to maintain consistency across platforms the Javascript API is used in the same manner as the PDFNet API available in Apryse's Web platform. Since access to the filesystem is included in Node.js/Electron some additional APIs requiring filesystem access have also been included.
4
4
 
5
5
  #### Supported platform, Node.js, and Electron versions
6
6
  This package depends on unmanaged add-on binaries, and the add-on binaries are not cross-platform. At the moment we have support for
7
- * **OS**: Linux (excluding Alpine), Windows(x64), Mac
8
- * **Node.js version**: 8 - 18
9
- * **Electron version**: 6 - 19
7
+ * **OS**: Linux, Windows(x64), Mac
8
+ * **Node.js version**: 10 - 24
9
+ * **Electron version**: 30 - 30
10
10
 
11
11
  Installation will fail if your OS, Node.js or Electron version is not supported.
12
12
 
@@ -32,7 +32,7 @@ PDFNet.runWithCleanup(main, 'YOUR_LICENSE_KEY').catch(function(error) {
32
32
 
33
33
  There are some code samples in the [@pdftron/pdfnet-node-samples](https://www.npmjs.com/package/@pdftron/pdfnet-node-samples) package.
34
34
 
35
- To get started please see the documentation at https://www.pdftron.com/documentation/nodejs/get-started/integration.
35
+ To get started please see the documentation at https://www.apryse.com/documentation/nodejs/get-started/integration.
36
36
 
37
37
  #### Licensing
38
- Please go to https://www.pdftron.com/pws/get-key to obtain a demo license or https://www.pdftron.com/form/contact-sales to obtain a production key. For further information, please visit https://www.pdftron.com/licensing.
38
+ Please go to https://www.apryse.com/pws/get-key to obtain a demo license or https://wwww.apryse.com/form/contact-sales to obtain a production key. For further information, please visit https://www.apryse.com/licensing.
@@ -0,0 +1,68 @@
1
+ const { execSync } = require('child_process');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const pkg = require(path.join(__dirname, '../package.json'));
5
+
6
+ const abi = process.versions.modules; // Node ABI
7
+ const platform = process.platform; // linux, darwin, win32
8
+ const arch = process.arch; // x64, arm64, etc.
9
+ const version = pkg.version;
10
+ const isElectron = !!process.versions.electron;
11
+ const remote_url = "https://downloads.apryse.com/downloads/nodejs"
12
+
13
+ let prebuildUrl = `${remote_url}/${version}/pdfnet-addon-v${version}-node-v${abi}-${platform}-${arch}.tar.gz`;
14
+ if (isElectron) {
15
+ electron_version = process.versions.electron;
16
+ prebuildUrl = `${remote_url}/${version}/pdfnet-addon-v${version}-electron-v${electron_version}-${platform}-${arch}.tar.gz`;
17
+ }
18
+
19
+ console.log('Downloading prebuilt binary from:', prebuildUrl);
20
+
21
+ try {
22
+ execSync(`npx prebuild-install --download ${prebuildUrl} --verbose`, { stdio: 'inherit' });
23
+
24
+ const extractedFolder = `node-v${abi}-${platform}-${arch}`;
25
+ const libFolder = path.join(extractedFolder, 'lib');
26
+ const targetLibFolder = path.join(process.cwd(), 'lib');
27
+
28
+ if (fs.existsSync(libFolder)) {
29
+ if (!fs.existsSync(targetLibFolder)) fs.mkdirSync(targetLibFolder);
30
+
31
+ console.log(`Copying contents of ${libFolder} to ${targetLibFolder}...`);
32
+
33
+ function copyRecursive(src, dest) {
34
+ if (fs.lstatSync(src).isDirectory()) {
35
+ if (!fs.existsSync(dest)) fs.mkdirSync(dest);
36
+ fs.readdirSync(src).forEach(file => {
37
+ copyRecursive(path.join(src, file), path.join(dest, file));
38
+ });
39
+ } else {
40
+ fs.renameSync(src, dest);
41
+ }
42
+ }
43
+
44
+ copyRecursive(libFolder, targetLibFolder);
45
+
46
+ function deleteFolderRecursive(folderPath) {
47
+ if (fs.existsSync(folderPath)) {
48
+ fs.readdirSync(folderPath).forEach(file => {
49
+ const curPath = path.join(folderPath, file);
50
+ if (fs.lstatSync(curPath).isDirectory()) {
51
+ deleteFolderRecursive(curPath);
52
+ } else {
53
+ fs.unlinkSync(curPath);
54
+ }
55
+ });
56
+ fs.rmdirSync(folderPath);
57
+ }
58
+ }
59
+
60
+ deleteFolderRecursive(extractedFolder);
61
+ console.log(`Cleanup complete: removed ${extractedFolder}`);
62
+ } else {
63
+ console.warn(`Lib folder not found at ${libFolder}, skipping move.`);
64
+ }
65
+ } catch (err) {
66
+ console.error('Error during prebuild-install:', err);
67
+ process.exit(1);
68
+ }