@pdftron/pdfnet-node-samples 9.5.0-5 → 9.5.0-5-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.
Files changed (145) hide show
  1. package/{samples/AddImageTest → AddImageTest}/AddImageTest.js +2 -2
  2. package/{samples/AdvancedImagingTest → AdvancedImagingTest}/AdvancedImagingTest.js +5 -5
  3. package/{samples/AnnotationTest → AnnotationTest}/AnnotationTest.js +1 -1
  4. package/BarcodeTest/BarcodeTest.js +120 -0
  5. package/{samples/BookmarkTest → BookmarkTest}/BookmarkTest.js +1 -1
  6. package/{samples/CAD2PDFTest → CAD2PDFTest}/CAD2PDFTest.js +5 -5
  7. package/{samples/ContentReplacerTest → ContentReplacerTest}/ContentReplacerTest.js +1 -1
  8. package/ConvertPrintTest/ConvertPrintTest.js +153 -0
  9. package/{samples/ConvertTest → ConvertTest}/ConvertTest.js +12 -79
  10. package/{samples/DataExtractionTest → DataExtractionTest}/DataExtractionTest.js +141 -10
  11. package/{samples/DigitalSignaturesTest → DigitalSignaturesTest}/DigitalSignaturesTest.js +126 -12
  12. package/DocumentCreationTest/DocumentCreationTest.js +409 -0
  13. package/{samples/ElementBuilderTest → ElementBuilderTest}/ElementBuilderTest.js +1 -1
  14. package/{samples/ElementEditTest → ElementEditTest}/ElementEditTest.js +1 -1
  15. package/{samples/ElementReaderAdvTest → ElementReaderAdvTest}/ElementReaderAdvTest.js +1 -1
  16. package/{samples/ElementReaderTest → ElementReaderTest}/ElementReaderTest.js +1 -1
  17. package/{samples/EncTest → EncTest}/EncTest.js +1 -1
  18. package/{samples/FDFTest → FDFTest}/FDFTest.js +1 -1
  19. package/FindReplaceTest/FindReplaceTest.js +56 -0
  20. package/{samples/HTML2PDFTest → HTML2PDFTest}/HTML2PDFTest.js +34 -35
  21. package/{samples/HighlightsTest → HighlightsTest}/HighlightsTest.js +1 -1
  22. package/{samples/ImageExtractTest → ImageExtractTest}/ImageExtractTest.js +3 -3
  23. package/{samples/ImpositionTest → ImpositionTest}/ImpositionTest.js +1 -1
  24. package/{samples/InteractiveFormsTest → InteractiveFormsTest}/InteractiveFormsTest.js +1 -1
  25. package/{samples/JBIG2Test → JBIG2Test}/JBIG2Test.js +7 -7
  26. package/{samples/LicenseKey → LicenseKey}/LicenseKey.js +3 -3
  27. package/{samples/LogicalStructureTest → LogicalStructureTest}/LogicalStructureTest.js +1 -1
  28. package/{samples/OCRTest → OCRTest}/OCRTest.js +6 -5
  29. package/{samples/OfficeTemplateTest → OfficeTemplateTest}/OfficeTemplateTest.js +2 -2
  30. package/{samples/OfficeToPDFTest → OfficeToPDFTest}/OfficeToPDFTest.js +1 -1
  31. package/{samples/OptimizerTest → OptimizerTest}/OptimizerTest.js +1 -1
  32. package/{samples/PDF2HtmlTest → PDF2HtmlTest}/PDF2HtmlTest.js +6 -6
  33. package/{samples/PDF2OfficeTest → PDF2OfficeTest}/PDF2OfficeTest.js +6 -6
  34. package/{samples/PDFATest → PDFATest}/PDFATest.js +1 -1
  35. package/{samples/PDFDocMemoryTest → PDFDocMemoryTest}/PDFDocMemoryTest.js +1 -1
  36. package/{samples/PDFDrawTest → PDFDrawTest}/PDFDrawTest.js +1 -1
  37. package/{samples/PDFLayersTest → PDFLayersTest}/PDFLayersTest.js +1 -1
  38. package/{samples/PDFPackageTest → PDFPackageTest}/PDFPackageTest.js +1 -1
  39. package/{samples/PDFPageTest → PDFPageTest}/PDFPageTest.js +1 -1
  40. package/{samples/PDFRedactTest → PDFRedactTest}/PDFRedactTest.js +1 -1
  41. package/PDFUATest/PDFUATest.js +88 -0
  42. package/{samples/PageLabelsTest → PageLabelsTest}/PageLabelsTest.js +1 -1
  43. package/{samples/PatternTest → PatternTest}/PatternTest.js +1 -1
  44. package/{samples/RectTest → RectTest}/RectTest.js +1 -1
  45. package/{samples/SDFTest → SDFTest}/SDFTest.js +3 -4
  46. package/{samples/StamperTest → StamperTest}/StamperTest.js +1 -1
  47. package/TestFiles/BusinessCardTemplate.pdf +0 -0
  48. package/TestFiles/Email.pdf +0 -0
  49. package/TestFiles/Fishermen.docx +0 -0
  50. package/TestFiles/Font_licenses.txt +140 -0
  51. package/TestFiles/Invoice.pdf +0 -0
  52. package/TestFiles/License.txt +1 -0
  53. package/TestFiles/Misc-Fixed.pfa +1166 -0
  54. package/TestFiles/NotoSans_with_hindi.ttf +0 -0
  55. package/TestFiles/Output/empty +1 -0
  56. package/TestFiles/SHA-2 Root USERTrust RSA CA Sectigo timestamping.crt +34 -0
  57. package/TestFiles/SYH_Letter.docx +0 -0
  58. package/TestFiles/Scientific_Publication.pdf +0 -0
  59. package/TestFiles/TigerText.pdf +0 -0
  60. package/TestFiles/US061222892-a.pdf +0 -0
  61. package/TestFiles/apryse.bmp +0 -0
  62. package/TestFiles/apryse.cer +0 -0
  63. package/TestFiles/apryse.pfx +0 -0
  64. package/TestFiles/autotag_input.pdf +0 -0
  65. package/TestFiles/butterfly.png +0 -0
  66. package/TestFiles/credit card numbers.pdf +0 -0
  67. package/TestFiles/dice.jpg +0 -0
  68. package/TestFiles/dice.u3d +0 -0
  69. package/TestFiles/doc_to_sign.pdf +0 -0
  70. package/TestFiles/factsheet_Arabic.docx +0 -0
  71. package/TestFiles/financial.pdf +0 -0
  72. package/TestFiles/find-replace-test.pdf +0 -0
  73. package/TestFiles/find-replace-test_(en_to_fr).xlf +88 -0
  74. package/TestFiles/fish.pdf +0 -0
  75. package/TestFiles/font.ttf +0 -0
  76. package/TestFiles/form1.pdf +246 -0
  77. package/TestFiles/form1_annots.xfdf +34 -0
  78. package/TestFiles/form1_data.fdf +4 -0
  79. package/TestFiles/form1_data.xfdf +140 -0
  80. package/TestFiles/formfields-scanned-withfields.pdf +0 -0
  81. package/TestFiles/formfields-scanned.pdf +0 -0
  82. package/TestFiles/formfields.pdf +0 -0
  83. package/TestFiles/grayscale.tif +0 -0
  84. package/TestFiles/hindi_sample_utf16le.txt +0 -0
  85. package/TestFiles/imagemask.dat +32 -0
  86. package/TestFiles/logo_red.png +0 -0
  87. package/TestFiles/lorem_ipsum.pdf +0 -0
  88. package/TestFiles/multipage.tif +0 -0
  89. package/TestFiles/my_stream.txt +2310 -0
  90. package/TestFiles/newsletter.pdf +0 -0
  91. package/TestFiles/newsletter.xod +0 -0
  92. package/TestFiles/numbered.pdf +0 -0
  93. package/TestFiles/op_blend_test.pdf +1497 -1
  94. package/TestFiles/palm.jp2 +0 -0
  95. package/TestFiles/paragraphs_and_tables.pdf +0 -0
  96. package/TestFiles/pdfnet.gif +0 -0
  97. package/TestFiles/pdftron_smart_substitution.plugin +0 -0
  98. package/TestFiles/peppers.jpg +0 -0
  99. package/TestFiles/signature.jpg +0 -0
  100. package/TestFiles/simple-emf.emf +0 -0
  101. package/TestFiles/simple-excel_2007.xlsx +0 -0
  102. package/TestFiles/simple-outlook.msg +0 -0
  103. package/TestFiles/simple-powerpoint_2007.pptx +0 -0
  104. package/TestFiles/simple-publisher.pub +0 -0
  105. package/TestFiles/simple-rtf.rtf +224 -0
  106. package/TestFiles/simple-text.txt +61 -0
  107. package/TestFiles/simple-visio.vsd +0 -0
  108. package/TestFiles/simple-webpage.html +731 -0
  109. package/TestFiles/simple-webpage.mht +6972 -0
  110. package/TestFiles/simple-webpage_files/colorschememapping.xml +2 -0
  111. package/TestFiles/simple-webpage_files/filelist.xml +14 -0
  112. package/TestFiles/simple-webpage_files/image001.gif +0 -0
  113. package/TestFiles/simple-webpage_files/image002.png +0 -0
  114. package/TestFiles/simple-webpage_files/image003.jpg +0 -0
  115. package/TestFiles/simple-webpage_files/image004.emz +0 -0
  116. package/TestFiles/simple-webpage_files/image005.gif +0 -0
  117. package/TestFiles/simple-webpage_files/image006.png +0 -0
  118. package/TestFiles/simple-webpage_files/image007.gif +0 -0
  119. package/TestFiles/simple-webpage_files/oledata.mso +0 -0
  120. package/TestFiles/simple-webpage_files/themedata.thmx +0 -0
  121. package/TestFiles/simple-word_2007.docx +0 -0
  122. package/TestFiles/simple-xps.xps +0 -0
  123. package/TestFiles/table.pdf +0 -0
  124. package/TestFiles/tagged.pdf +0 -0
  125. package/TestFiles/the_rime_of_the_ancient_mariner.docx +0 -0
  126. package/TestFiles/tiger.pdf +0 -0
  127. package/TestFiles/tiger.svg +378 -0
  128. package/TestFiles/waiver.pdf +0 -0
  129. package/TestFiles/waiver_withApprovalField.pdf +0 -0
  130. package/TestFiles/waiver_withApprovalField_certified.pdf +421 -1
  131. package/TestFiles/waiver_withApprovalField_certified_approved.pdf +465 -1
  132. package/{samples/TextExtractTest → TextExtractTest}/TextExtractTest.js +1 -1
  133. package/{samples/TextSearchTest → TextSearchTest}/TextSearchTest.js +2 -2
  134. package/TransPDFTest/TransPDFTest.js +68 -0
  135. package/{samples/U3DTest → U3DTest}/U3DTest.js +1 -1
  136. package/{samples/UndoRedoTest → UndoRedoTest}/UndoRedoTest.js +1 -1
  137. package/{samples/UnicodeWriteTest → UnicodeWriteTest}/UnicodeWriteTest.js +1 -1
  138. package/{samples/WebViewerConvertTest → WebViewerConvertTest}/WebViewerConvertTest.js +2 -2
  139. package/legal.txt +632 -0
  140. package/license.pdf +0 -0
  141. package/package.json +8 -6
  142. package/readme.md +32 -7
  143. package/{samples/runall.bat → runall.bat} +12 -12
  144. package/scripts/install.js +68 -0
  145. /package/{samples/runall.sh → runall.sh} +0 -0
package/readme.md CHANGED
@@ -1,13 +1,38 @@
1
- ## @pdftron/pdfnet-node-samples
1
+ ## @pdftron/pdfnet-node
2
2
 
3
- This package contains sample code for [@pdftron/pdfnet-node](https://www.npmjs.com/package/@pdftron/pdfnet-node).
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
- #### Run the samples
6
- Please enter your license key by replacing the LicenseKey variable value in *@pdftron/pdfnet-node-samples/samples/LicenseKey/LicenseKey.js*.
5
+ #### Supported platform, Node.js, and Electron versions
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, Windows(x64), Mac
8
+ * **Node.js version**: 10 - 24
9
+ * **Electron version**: 30 - 30
10
+
11
+ Installation will fail if your OS, Node.js or Electron version is not supported.
7
12
 
8
- Run `npm run test` in the *@pdftron/pdfnet-node-samples* directory to run all the samples.
13
+ To install for Electron, *runtime* and *target* options are needed. For example, For Electron 6, we need to run *npm i @pdftron/pdfnet-node --runtime=electron --target=6.0.0*. Note that we need to use *6.0.0* for all Electron 6 versions.
9
14
 
10
- The samples are in the *@pdftron/pdfnet-node-samples/samples* directory after the installation for Node.js.
15
+ #### Usage
16
+ Here is a code snippet to demonstrate how to use this package.
17
+ ```javascript
18
+ const { PDFNet } = require('@pdftron/pdfnet-node'); // you may need to set up NODE_PATH environment variable to make this work.
19
+
20
+ const main = async() => {
21
+ const doc = await PDFNet.PDFDoc.create();
22
+ const page = await doc.pageCreate();
23
+ doc.pagePushBack(page);
24
+ doc.save('blank.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
25
+ };
26
+
27
+ // add your own license key as the second parameter, e.g. in place of 'YOUR_LICENSE_KEY'.
28
+ PDFNet.runWithCleanup(main, 'YOUR_LICENSE_KEY').catch(function(error) {
29
+ console.log('Error: ' + JSON.stringify(error));
30
+ }).then(function(){ return PDFNet.shutdown(); });
31
+ ```
32
+
33
+ There are some code samples in the [@pdftron/pdfnet-node-samples](https://www.npmjs.com/package/@pdftron/pdfnet-node-samples) package.
34
+
35
+ To get started please see the documentation at https://www.apryse.com/documentation/nodejs/get-started/integration.
11
36
 
12
37
  #### Licensing
13
- 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.
@@ -1,12 +1,12 @@
1
- @echo off
2
- for /D %%s in (*Test) do (
3
- if exist %%s\%%~nxs.js (
4
- cd %%s
5
- echo %%s running...
6
- call node %%~nxs.js
7
- cd ..
8
- echo %%s finished.
9
- pause
10
- )
11
- )
12
- echo All tests finished.
1
+ @echo off
2
+ for /D %%s in (*Test) do (
3
+ if exist %%s\%%~nxs.js (
4
+ cd %%s
5
+ echo %%s running...
6
+ call node %%~nxs.js
7
+ cd ..
8
+ echo %%s finished.
9
+ pause
10
+ )
11
+ )
12
+ echo All tests finished.
@@ -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
+ }
File without changes