@pdftron/pdfnet-node-samples 11.2.0 → 11.3.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.
@@ -78,7 +78,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
78
78
  outputFile = outputPath + 'financial.xlsx';
79
79
  const outputXlsxStream = await PDFNet.Filter.createMemoryFilter(0, false);
80
80
  const options = new PDFNet.DataExtractionModule.DataExtractionOptions();
81
- options.setPages("1"); // page 1
81
+ options.setPages('1'); // page 1
82
82
  await PDFNet.DataExtractionModule.extractToXLSXWithFilter(inputPath + 'financial.pdf', outputXlsxStream, options);
83
83
  outputXlsxStream.memoryFilterSetAsInputFilter();
84
84
  outputXlsxStream.writeToFile(outputFile, false);
@@ -167,7 +167,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
167
167
  {
168
168
  console.log('Detect and add form fields in a PDF file, keep new fields');
169
169
 
170
- const doc = await PDFNet.PDFDoc.createFromFilePath(inputPath + "formfields-scanned-withfields.pdf");
170
+ const doc = await PDFNet.PDFDoc.createFromFilePath(inputPath + 'formfields-scanned-withfields.pdf');
171
171
 
172
172
  await PDFNet.DataExtractionModule.detectAndAddFormFieldsToPDF(doc);
173
173
  outputFile = outputPath + 'formfields-scanned-fields-new.pdf';
@@ -182,7 +182,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
182
182
  {
183
183
  console.log('Detect and add form fields in a PDF file, keep old fields');
184
184
 
185
- const doc = await PDFNet.PDFDoc.createFromFilePath(inputPath + "formfields-scanned-withfields.pdf");
185
+ const doc = await PDFNet.PDFDoc.createFromFilePath(inputPath + 'formfields-scanned-withfields.pdf');
186
186
 
187
187
  const options = new PDFNet.DataExtractionModule.DataExtractionOptions();
188
188
  options.setOverlappingFormFieldBehavior('KeepOld');
@@ -199,6 +199,51 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
199
199
  }
200
200
  }
201
201
 
202
+ //////////////////////////////////////////////////////////////////////////
203
+ // The following sample illustrates how to extract key-value pairs from PDF documents.
204
+ //////////////////////////////////////////////////////////////////////////
205
+ if (!await PDFNet.DataExtractionModule.isModuleAvailable(PDFNet.DataExtractionModule.DataExtractionEngine.e_GenericKeyValue)) {
206
+ console.log();
207
+ console.log('Unable to run Data Extraction: Apryse SDK AIPageObjectExtractor module not available.');
208
+ console.log('---------------------------------------------------------------');
209
+ console.log('The Data Extraction suite is an optional add-on, available for download');
210
+ console.log('at http://www.pdftron.com/. If you have already downloaded this');
211
+ console.log('module, ensure that the SDK is able to find the required files');
212
+ console.log('using the PDFNet.addResourceSearchPath() function.');
213
+ console.log();
214
+ }
215
+ else
216
+ {
217
+ try {
218
+ // Simple example: Extract Keys & Values as a JSON file
219
+ console.log('Extract Key-Value pairs as a JSON file');
220
+ await PDFNet.DataExtractionModule.extractData(inputPath + 'newsletter.pdf', outputPath + 'newsletter_key_val.json', PDFNet.DataExtractionModule.DataExtractionEngine.e_GenericKeyValue);
221
+ console.log('Result saved in ' + outputPath + 'newsletter_key_val.json');
222
+
223
+ const options = new PDFNet.DataExtractionModule.DataExtractionOptions();
224
+ options.setPages('2-4');
225
+
226
+ const p2ExclusionZones = [];
227
+ // Exclude the ad on page 2
228
+ // These coordinates are in PDF user space, with the origin at the bottom left corner of the page
229
+ // Coordinates rotate with the page, if it has rotation applied.
230
+ p2ExclusionZones.push(new PDFNet.Rect(166, 47, 562, 222));
231
+ options.addExclusionZonesForPage(p2ExclusionZones, 2);
232
+
233
+ const p4InclusionZones = [];
234
+ const p4ExclusionZones = [];
235
+ // Only include the article text for page 4, exclude ads and headings
236
+ p4InclusionZones.push(new PDFNet.Rect(30, 432, 562, 684));
237
+ p4ExclusionZones.push(new PDFNet.Rect(30, 657, 295, 684));
238
+ options.addInclusionZonesForPage(p4InclusionZones, 4);
239
+ options.addExclusionZonesForPage(p4ExclusionZones, 4);
240
+ console.log('Extract Key-Value pairs from specific pages and zones as a JSON file');
241
+ await PDFNet.DataExtractionModule.extractData(inputPath + 'newsletter.pdf', outputPath + 'newsletter_key_val_with_zones.json', PDFNet.DataExtractionModule.DataExtractionEngine.e_GenericKeyValue, options);
242
+ console.log('Result saved in ' + outputPath + 'newsletter_key_val_with_zones.json');
243
+ } catch (err) {
244
+ console.log(err);
245
+ }
246
+ }
202
247
  //////////////////////////////////////////////////////////////////////////
203
248
 
204
249
  console.log('Done.');
@@ -513,9 +513,9 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
513
513
  try {
514
514
  await CertifyPDF(input_path + 'waiver_withApprovalField.pdf',
515
515
  'PDFTronCertificationSig',
516
- input_path + 'pdftron.pfx',
516
+ input_path + 'apryse.pfx',
517
517
  'password',
518
- input_path + 'pdftron.bmp',
518
+ input_path + 'apryse.bmp',
519
519
  output_path + 'waiver_withApprovalField_certified_output.pdf');
520
520
  await PrintSignaturesInfo(output_path + 'waiver_withApprovalField_certified_output.pdf');
521
521
  } catch (err) {
@@ -527,7 +527,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
527
527
  try {
528
528
  await SignPDF(input_path + 'waiver_withApprovalField_certified.pdf',
529
529
  'PDFTronApprovalSig',
530
- input_path + 'pdftron.pfx',
530
+ input_path + 'apryse.pfx',
531
531
  'password',
532
532
  input_path + 'signature.jpg',
533
533
  output_path + 'waiver_withApprovalField_certified_approved_output.pdf');
@@ -551,7 +551,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
551
551
  //////////////////// TEST 4: Verify a document's digital signatures.
552
552
  // EXPERIMENTAL. Digital signature verification is undergoing active development, but currently does not support a number of features. If we are missing a feature that is important to you, or if you have files that do not act as expected, please contact us using one of the following forms: https://apryse.com/form/trial-support or https://apryse.com/form/request
553
553
  try {
554
- if (!(await VerifyAllAndPrint(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'pdftron.cer'))) {
554
+ if (!(await VerifyAllAndPrint(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'apryse.cer'))) {
555
555
  ret = 1;
556
556
  }
557
557
  } catch (err) {
@@ -561,7 +561,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
561
561
 
562
562
  //////////////////// TEST 5: Verify a document's digital signatures in a simple fashion using the document API.
563
563
  try {
564
- if (!(await VerifySimple(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'pdftron.cer'))) {
564
+ if (!(await VerifySimple(input_path + 'waiver_withApprovalField_certified_approved.pdf', input_path + 'apryse.cer'))) {
565
565
  ret = 1;
566
566
  }
567
567
  } catch (err) {
@@ -578,9 +578,9 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
578
578
  try {
579
579
  await CustomSigningAPI(input_path + 'waiver.pdf',
580
580
  'PDFTronCertificationSig',
581
- input_path + 'pdftron.pfx',
581
+ input_path + 'apryse.pfx',
582
582
  'password',
583
- input_path + 'pdftron.cer',
583
+ input_path + 'apryse.cer',
584
584
  input_path + 'signature.jpg',
585
585
  PDFNet.DigestAlgorithm.Type.e_SHA256,
586
586
  true,
@@ -1,5 +1,5 @@
1
1
  //---------------------------------------------------------------------------------------
2
- // Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
2
+ // Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3
3
  // Consult legal.txt regarding legal and license information.
4
4
  //---------------------------------------------------------------------------------------
5
5
 
Binary file
package/legal.txt CHANGED
@@ -2,7 +2,7 @@
2
2
  Legal Notices:
3
3
  -----------------------------------------------------------------------------
4
4
 
5
- Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
5
+ Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
6
6
  Apryse, PDFTron and PDFNet SDK are either trademarks and/or service marks
7
7
  and/or registered trademarks of Apryse Software Incorporated
8
8
  in Canada and/or other countries.
@@ -124,7 +124,7 @@ and fitness for purpose.
124
124
  ---------------------------------------------------------------------------
125
125
  Boost
126
126
 
127
- CopyRight (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
127
+ CopyRight (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
128
128
  CopyRight Aaron W. LaFramboise, Roland Schwarz, Michael Glassford 2004.
129
129
  CopyRight Anthony Williams 2007
130
130
  CopyRight Beman Dawes 2002-2010
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdftron/pdfnet-node-samples",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "description": "Sample code for the @pdftron/pdfnet-node package.",
5
5
  "scripts": {
6
6
  "test": "run-script-os",
@@ -12,7 +12,7 @@
12
12
  "license": "Commercial",
13
13
  "homepage": "https://www.pdftron.com",
14
14
  "dependencies": {
15
- "@pdftron/pdfnet-node": "^11.2.0",
15
+ "@pdftron/pdfnet-node": "^11.3.0",
16
16
  "run-script-os": "^1.1.6",
17
17
  "underscore": "^1.13.6",
18
18
  "xhr2": "^0.2.1"
package/readme.md CHANGED
@@ -4,7 +4,7 @@ This package leverages the full power of Apryse's native SDK for maximal perform
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
7
+ * **OS**: Linux, Windows(x64), Mac
8
8
  * **Node.js version**: 8 - 22
9
9
  * **Electron version**: 30 - 30
10
10
 
Binary file
File without changes
File without changes