@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
@@ -0,0 +1,68 @@
1
+ //---------------------------------------------------------------------------------------
2
+ // Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3
+ // Consult legal.txt regarding legal and license information.
4
+ //---------------------------------------------------------------------------------------
5
+
6
+ //---------------------------------------------------------------------------------------
7
+ // The following sample illustrates how to extract xlf from a PDF document for translation.
8
+ // It then applies a pre-prepared translated xlf file to the PDF to produce a translated PDF.
9
+ //---------------------------------------------------------------------------------------
10
+
11
+ const { PDFNet } = require('@pdftron/pdfnet-node');
12
+ const PDFTronLicense = require('../LicenseKey/LicenseKey');
13
+
14
+ ((exports) => {
15
+
16
+ exports.runTransPDF = () => {
17
+
18
+ const main = async () => {
19
+ // Relative path to the folder containing test files.
20
+ const inputPath = '../TestFiles/';
21
+ const outputPath = inputPath + 'Output/';
22
+
23
+ try {
24
+ // start stack-based deallocation with startDeallocateStack. Later on when endDeallocateStack is called,
25
+ // all objects in memory that were initialized since the most recent startDeallocateStack call will be
26
+ // cleaned up. Doing this makes sure that memory growth does not get too high.
27
+ await PDFNet.startDeallocateStack();
28
+
29
+ // Open a PDF document to translate
30
+ const doc = await PDFNet.PDFDoc.createFromFilePath(inputPath + 'find-replace-test.pdf');
31
+
32
+ const options = await PDFNet.TransPDF.createTransPDFOptions();
33
+
34
+ // Set the source language in the options
35
+ options.setSourceLanguage("en");
36
+
37
+ // Set the number of pages to process in each batch
38
+ options.setBatchSize(20);
39
+
40
+ // Optionally, subset the pages to process
41
+ // This PDF only has a single page, but you can specify a subset of pages like this
42
+ // options.setPages("-2,5-6,9,11-");
43
+
44
+ // Extract the xlf to file and field the PDF for translation
45
+ await PDFNet.TransPDF.extractXLIFF(doc, outputPath + 'find-replace-test.xlf', options);
46
+
47
+ // Save the fielded PDF
48
+ await doc.save(outputPath + 'find-replace-test-fielded.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
49
+
50
+ // The extracted xlf can be translated in a system of your choice.
51
+ // In this sample a pre-prepared translated file is used - find-replace-test_(en_to_fr).xlf
52
+
53
+ // Perform the translation using the pre-prepared translated xliff
54
+ await PDFNet.TransPDF.applyXLIFF(doc, inputPath + "find-replace-test_(en_to_fr).xlf", options);
55
+
56
+ await doc.save(outputPath + 'find-replace-test-fr.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
57
+
58
+ await PDFNet.endDeallocateStack();
59
+ } catch (err) {
60
+ console.log(err.stack);
61
+ }
62
+ };
63
+ PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function (error) { console.log('Error: ' + JSON.stringify(error)); }).then(function () { return PDFNet.shutdown(); });
64
+ };
65
+ exports.runTransPDF();
66
+ })(exports);
67
+ // eslint-disable-next-line spaced-comment
68
+ //# sourceURL=TransPDF.js
@@ -1,5 +1,5 @@
1
1
  //---------------------------------------------------------------------------------------
2
- // Copyright (c) 2001-2023 by PDFTron Systems 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
 
@@ -1,5 +1,5 @@
1
1
  //---------------------------------------------------------------------------------------
2
- // Copyright (c) 2001-2023 by PDFTron Systems 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
 
@@ -1,5 +1,5 @@
1
1
  //---------------------------------------------------------------------------------------
2
- // Copyright (c) 2001-2023 by PDFTron Systems 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
 
@@ -1,5 +1,5 @@
1
1
  //---------------------------------------------------------------------------------------
2
- // Copyright (c) 2001-2023 by PDFTron Systems 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
 
@@ -23,7 +23,7 @@
23
23
  //
24
24
  // Please note that PDFNet Publisher (i.e. 'pdftron.PDF.Convert.ToXod') is an
25
25
  // optionally licensable add-on to PDFNet Core SDK. For details, please see
26
- // http://www.pdftron.com/webviewer/licensing.html.
26
+ // https://apryse.com/pricing.
27
27
  //---------------------------------------------------------------------------------------
28
28
 
29
29
  const { PDFNet } = require('@pdftron/pdfnet-node');