@pdftron/pdfnet-node-samples 11.13.0 → 12.0.0-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.
@@ -23,7 +23,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
23
23
  const main = async () => {
24
24
 
25
25
  try {
26
- await PDFNet.addResourceSearchPath('../Lib/');
26
+ await PDFNet.addResourceSearchPath('../../Lib/');
27
27
 
28
28
  if (!await PDFNet.AdvancedImagingModule.isModuleAvailable()) {
29
29
  console.log('\nUnable to run AdvancedImagingTest: Apryse SDK AdvancedImaging module not available.');
@@ -20,7 +20,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
20
20
  exports.runBarcodeTest = () => {
21
21
  const main = async () => {
22
22
 
23
- PDFNet.addResourceSearchPath('../Lib/');
23
+ PDFNet.addResourceSearchPath('../../Lib/');
24
24
 
25
25
  if (!(await PDFNet.BarcodeModule.isModuleAvailable())) {
26
26
  console.log('\nUnable to run BarcodeTest: Apryse SDK Barcode Module not available.');
@@ -33,7 +33,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
33
33
 
34
34
  const main = async () => {
35
35
  try {
36
- await PDFNet.addResourceSearchPath('../Lib/');
36
+ await PDFNet.addResourceSearchPath('../../Lib/');
37
37
  if (!(await PDFNet.CADModule.isModuleAvailable())) {
38
38
  console.log('\nUnable to run CAD2PDFTest: Apryse SDK CAD module not available.');
39
39
  console.log('---------------------------------------------------------------');
@@ -0,0 +1,65 @@
1
+ //---------------------------------------------------------------------------------------
2
+ // Copyright (c) 2001-2026 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 use the PDFNet.DOCXCompare utility
8
+ // class to compare two MS Word (DOCX) documents and produce a new DOCX document
9
+ // containing the differences between them as tracked changes.
10
+ //
11
+ // This comparison is performed entirely within the PDFNet and has *no*
12
+ // external or system dependencies -- Comparison results will be
13
+ // the same whether on Windows, Linux or Android.
14
+ //
15
+ // Please contact us if you have any questions.
16
+ //------------------------------------------------------------------------------
17
+
18
+ const { PDFNet } = require('@pdftron/pdfnet-node');
19
+ const PDFTronLicense = require('../LicenseKey/LicenseKey');
20
+
21
+ ((exports) => {
22
+
23
+ exports.runDOCXCompareTest = () => {
24
+
25
+ const main = async() => {
26
+ // Relative paths to folders containing test files.
27
+ const inputPath = '../TestFiles/';
28
+ const outputPath = '../TestFiles/Output/';
29
+
30
+ // Provide your own original and revised versions of a DOCX document here.
31
+ const originalFilename = 'SYH_Letter.docx';
32
+ const revisedFilename = 'SYH_Letter_revision2.docx';
33
+ const outputFilename = 'SYH_Letter_changes.docx';
34
+
35
+ try {
36
+ const options = await PDFNet.DOCXCompare.createDOCXCompareOptions();
37
+
38
+ // Compare the two DOCX documents, writing the differences as tracked
39
+ // changes into the output DOCX document.
40
+ const result = await PDFNet.DOCXCompare.compare(
41
+ inputPath + originalFilename,
42
+ inputPath + revisedFilename,
43
+ outputPath + outputFilename,
44
+ options
45
+ );
46
+
47
+ // And we're done!
48
+ if (await result.differencesDetected()) {
49
+ console.log('Differences detected, saved to ' + outputFilename);
50
+ } else {
51
+ console.log('No difference detected');
52
+ }
53
+ } catch (err) {
54
+ console.log(err.stack);
55
+ }
56
+
57
+ console.log('Done.');
58
+ };
59
+ PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error){console.log('Error: ' + JSON.stringify(error));}).then(function(){return PDFNet.shutdown();});
60
+ };
61
+ exports.runDOCXCompareTest();
62
+ })(exports);
63
+ // eslint-disable-next-line spaced-comment
64
+ //# sourceURL=DOCXCompareTest.js
65
+
@@ -26,7 +26,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
26
26
 
27
27
  //////////////////////////////////////////////////////////////////////////
28
28
 
29
- await PDFNet.addResourceSearchPath('../Lib/');
29
+ await PDFNet.addResourceSearchPath('../../Lib/');
30
30
 
31
31
  //////////////////////////////////////////////////////////////////////////
32
32
  // The following sample illustrates how to extract tables from PDF documents.
@@ -37,7 +37,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
37
37
  // For HTML2PDF we need to locate the html2pdf module. If placed with the
38
38
  // PDFNet library, or in the current working directory, it will be loaded
39
39
  // automatically. Otherwise, it must be set manually using HTML2PDF.setModulePath.
40
- await PDFNet.HTML2PDF.setModulePath('../../lib/');
40
+ await PDFNet.HTML2PDF.setModulePath('../../Lib/');
41
41
 
42
42
  if(!(await PDFNet.HTML2PDF.isModuleAvailable())) {
43
43
  console.log('Unable to run HTML2PDFTest: Apryse SDK HTML2PDF module not available.');
@@ -20,7 +20,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
20
20
  const main = async () => {
21
21
  try {
22
22
  // The location of the Handwriting ICR Module
23
- PDFNet.addResourceSearchPath('../Lib/');
23
+ PDFNet.addResourceSearchPath('../../Lib/');
24
24
 
25
25
  if (!(await PDFNet.HandwritingICRModule.isModuleAvailable())) {
26
26
  console.log('\nUnable to run HandwritingICRTest: Apryse SDK Handwriting ICR Module');
@@ -17,7 +17,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
17
17
  const main = async () => {
18
18
  try {
19
19
 
20
- PDFNet.addResourceSearchPath('../Lib/');
20
+ PDFNet.addResourceSearchPath('../../Lib/');
21
21
 
22
22
  const useIRIS = await PDFNet.OCRModule.isIRISModuleAvailable();
23
23
  if (!(await PDFNet.OCRModule.isModuleAvailable())) {
@@ -50,7 +50,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
50
50
 
51
51
  //////////////////////////////////////////////////////////////////////////
52
52
 
53
- await PDFNet.addResourceSearchPath('../Lib/');
53
+ await PDFNet.addResourceSearchPath('../../Lib/');
54
54
 
55
55
  if (!await PDFNet.StructuredOutputModule.isModuleAvailable()) {
56
56
  console.log('\nUnable to run part of the sample: Apryse SDK Structured Output module not available.');
@@ -31,7 +31,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
31
31
 
32
32
  //////////////////////////////////////////////////////////////////////////
33
33
 
34
- await PDFNet.addResourceSearchPath('../Lib/');
34
+ await PDFNet.addResourceSearchPath('../../Lib/');
35
35
 
36
36
  if (!await PDFNet.StructuredOutputModule.isModuleAvailable()) {
37
37
  console.log('\nUnable to run the sample: Apryse SDK Structured Output module not available.');
@@ -27,7 +27,7 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
27
27
 
28
28
  // DataExtraction library location, replace if desired, should point to a folder that includes the contents of <DataExtractionModuleRoot>/Lib.
29
29
  // If using default, unzip the DataExtraction zip to the parent folder of Samples, and merge with existing "Lib" folder
30
- const extraction_module_path = '../Lib/';
30
+ const extraction_module_path = '../../Lib/';
31
31
 
32
32
  const input_file1 = input_path + 'autotag_input.pdf';
33
33
  const input_file2 = input_path + 'table.pdf';
@@ -0,0 +1,121 @@
1
+ //---------------------------------------------------------------------------------------
2
+ // Copyright (c) 2001-2026 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 convert documents to PDF format by printing
8
+ // them to the Apryse PDF printer via the Windows print verb, using the
9
+ // 'PDFNet.PrintToPdfModule' class.
10
+ //
11
+ // The PrintToPdf module is an optional PDFNet Add-on that can be used to convert any
12
+ // printable document into a PDF.
13
+ //
14
+ // The Apryse SDK PrintToPdf module can be downloaded from http://www.apryse.com/
15
+ //
16
+ // Note: The PrintToPdf module is only available on Windows.
17
+ //---------------------------------------------------------------------------------------
18
+
19
+ const { PDFNet } = require('@pdftron/pdfnet-node');
20
+ const PDFTronLicense = require('../LicenseKey/LicenseKey');
21
+
22
+ ((exports) => {
23
+ 'use strict';
24
+
25
+ exports.runPrintToPdfTest = () => {
26
+
27
+ const main = async () => {
28
+ try {
29
+ await PDFNet.addResourceSearchPath('../../Lib/');
30
+ if (!(await PDFNet.PrintToPdfModule.isModuleAvailable())) {
31
+ console.log('\nUnable to run PrintToPdfTest: Apryse SDK PrintToPdf module not available.');
32
+ console.log('---------------------------------------------------------------');
33
+ console.log('The PrintToPdf module is an optional add-on, available for download');
34
+ console.log('at http://www.apryse.com/. If you have already downloaded this');
35
+ console.log('module, ensure that the SDK is able to find the required files');
36
+ console.log('using the PDFNet.addResourceSearchPath() function.\n');
37
+
38
+ return;
39
+ }
40
+
41
+ // Relative paths to the folders containing test files.
42
+ const inputPath = '../TestFiles/';
43
+ const outputPath = '../TestFiles/Output/';
44
+
45
+ // ---------------------------------------------------------------------
46
+ // Test case 1: print a single file to PDF.
47
+ // ---------------------------------------------------------------------
48
+ const inputFileName = 'simple-word_2007.docx';
49
+ const outputFileName = inputFileName + '.pdf';
50
+
51
+ try {
52
+ const doc = await PDFNet.PDFDoc.create();
53
+ doc.initSecurityHandler();
54
+
55
+ // Convert the document with some user options
56
+ const opts = new PDFNet.PrintToPdfModule.PrintToPdfOptions();
57
+ opts.setPageOrientation('portrait');
58
+ opts.setHorizontalPageMargin(18);
59
+ opts.setVerticalPageMargin(18);
60
+ // Page width and height in points (1/72 of an inch).
61
+ // If both are zero (default), letter paper size is used.
62
+ // opts.setPageWidth(612);
63
+ // opts.setPageHeight(792);
64
+
65
+ await PDFNet.PrintToPdfModule.printToPdf(doc, inputPath + inputFileName, opts);
66
+ await doc.save(outputPath + outputFileName, PDFNet.SDFDoc.SaveOptions.e_linearized);
67
+ console.log('Printed file: ' + inputFileName);
68
+ console.log('to: ' + outputFileName);
69
+ } catch (err) {
70
+ console.log('Unable to convert file ' + inputFileName);
71
+ console.log(err);
72
+ }
73
+
74
+ // ---------------------------------------------------------------------
75
+ // Test case 2: print multiple files into a single combined PDF using
76
+ // the array overload of PDFNet.PrintToPdfModule.printToPdfWithArray.
77
+ // ---------------------------------------------------------------------
78
+ const filesToPrint = [
79
+ inputPath + 'simple-word_2007.docx',
80
+ inputPath + 'simple-emf.emf',
81
+ inputPath + 'simple-emf.emf',
82
+ inputPath + 'simple-powerpoint_2007.pptx',
83
+ inputPath + 'simple-excel_2007.xlsx',
84
+ inputPath + 'my_stream.txt',
85
+ ];
86
+
87
+ const combinedOutput = outputPath + 'PrintToPdf_combined.pdf';
88
+
89
+ try {
90
+ const doc = await PDFNet.PDFDoc.create();
91
+ doc.initSecurityHandler();
92
+
93
+ const opts = new PDFNet.PrintToPdfModule.PrintToPdfOptions();
94
+ opts.setPageOrientation('portrait');
95
+ opts.setHorizontalPageMargin(18);
96
+ opts.setVerticalPageMargin(18);
97
+
98
+ await PDFNet.PrintToPdfModule.printToPdfWithArray(doc, filesToPrint, opts);
99
+ await doc.save(combinedOutput, PDFNet.SDFDoc.SaveOptions.e_linearized);
100
+
101
+ console.log('Printed ' + filesToPrint.length + ' file(s) into combined PDF:');
102
+ for (let j = 0; j < filesToPrint.length; ++j) {
103
+ console.log(' ' + filesToPrint[j]);
104
+ }
105
+ console.log('to: ' + combinedOutput);
106
+ } catch (err) {
107
+ console.log('Unable to convert combined file list');
108
+ console.log(err);
109
+ }
110
+ } catch (err) {
111
+ console.log(err);
112
+ }
113
+ };
114
+ PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function (error) {
115
+ console.log('Error: ' + JSON.stringify(error));
116
+ }).then(function () { return PDFNet.shutdown(); });
117
+ };
118
+ exports.runPrintToPdfTest();
119
+ })(exports);
120
+ // eslint-disable-next-line spaced-comment
121
+ //# sourceURL=PrintToPdfTest.js
@@ -0,0 +1,90 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en">
3
+ <file id="f-1" original="../../TestFiles/find-replace-test.pdf">
4
+ <unit id="A-a">
5
+ <!--
6
+ <fmt id="1-0" name="0" size="14.0" rise="0.0" scale="100"
7
+ colour="ffffff" colid="0" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
8
+ underline="0" strike="0" link=""/>
9
+ -->
10
+ <segment id='p1-1' state="initial">
11
+ <source>2 </source>
12
+ <target>2 </target>
13
+ </segment>
14
+ </unit>
15
+ <unit id="A-LR">
16
+ <!--
17
+ <fmt id="2-0" name="0" size="12.0" rise="0.0" scale="100"
18
+ colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
19
+ underline="0" strike="0" link=""/>
20
+ -->
21
+ <segment id='p1-2' state="initial">
22
+ <source>You plan to embed PDF functionality into an application. But before you dive into the project, you must decide: do you go with a more expensive commercial PDF SDK — or a lower-cost alternative such as an open-source library or an open-source wrapper?</source>
23
+ <target>Vous envisagez d&#8217;int&#233;grer des fonctionnalit&#233;s PDF dans une application. Mais avant de vous lancer dans le projet, vous devez d&#233;cider : optez-vous pour un SDK PDF commercial plus co&#251;teux - ou une alternative moins co&#251;teuse telle qu&#8217;une biblioth&#232;que open source ou un wrapper open source ?</target>
24
+ </segment>
25
+
26
+ <!--
27
+ <fmt id="3-0" name="0" size="12.0" rise="0.0" scale="100"
28
+ colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
29
+ underline="0" strike="0" link=""/>
30
+ -->
31
+ <segment id='p1-3' state="initial">
32
+ <source>There are non-trivial costs to switching later. Developers have to re-learn the new library, re-adjust the backend, customize the UI to match what users are accustomed to, as well as migrate documents, form data, annotations, and more. </source>
33
+ <target>Il y a des co&#251;ts non n&#233;gligeables &#224; changer plus tard. Les d&#233;veloppeurs doivent r&#233;apprendre la nouvelle biblioth&#232;que, r&#233;ajuster le backend, personnaliser l&#8217;interface utilisateur pour qu&#8217;elle corresponde &#224; ce &#224; quoi les utilisateurs sont habitu&#233;s, ainsi que migrer des documents, des donn&#233;es de formulaire, des annotations, etc. </target>
34
+ </segment>
35
+
36
+ <!--
37
+ <fmt id="4-0" name="0" size="12.0" rise="0.0" scale="100"
38
+ colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
39
+ underline="0" strike="0" link=""/>
40
+
41
+ <fmt id="4-1" name="1" size="12.0" rise="0.0" scale="100"
42
+ colour="1d446c" colid="1" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
43
+ underline="1" strike="0" link=""/>
44
+ -->
45
+ <segment id='p1-4' state="initial">
46
+ <source>
47
+ According to <pc id='4-1' type='fmt'>market research</pc> conducted by Stax Inc., the average Net Promoter Score (NPS) for the top five PDF SDK vendors is 35%. And 70% of customers express interest in switching despite the high costs.
48
+ </source>
49
+ <target>D&#8217;apr&#232;s une <pc id='4-1' type='fmt'>&#233;tude de march&#233;</pc> men&#233;e par Stax Inc., le Net Promoter Score (NPS) moyen des cinq principaux fournisseurs de SDK PDF est de 35 %. Et 70 % des clients expriment leur int&#233;r&#234;t &#224; changer de client malgr&#233; les co&#251;ts &#233;lev&#233;s.</target>
50
+ </segment>
51
+
52
+ <!--
53
+ <fmt id="5-0" name="0" size="12.0" rise="0.0" scale="100"
54
+ colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
55
+ underline="0" strike="0" link=""/>
56
+ -->
57
+ <segment id='p1-5' state="initial">
58
+ <source>This dissatisfaction implies that picking the right PDF SDK is a lot harder than it seems. And to help you avoid the same mistakes as past implementations, we’ve written this article.</source>
59
+ <target>Cette insatisfaction implique que choisir le bon SDK PDF est beaucoup plus difficile qu&#8217;il n&#8217;y para&#238;t. Et pour vous aider &#224; &#233;viter les m&#234;mes erreurs que les impl&#233;mentations pr&#233;c&#233;dentes, nous avons r&#233;dig&#233; cet article.</target>
60
+ </segment>
61
+
62
+ <!--
63
+ <fmt id="6-0" name="0" size="12.0" rise="0.0" scale="100"
64
+ colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
65
+ underline="0" strike="0" link=""/>
66
+
67
+ <fmt id="6-1" name="1" size="12.0" rise="0.0" scale="100"
68
+ colour="1d446c" colid="1" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
69
+ underline="1" strike="0" link=""/>
70
+ -->
71
+ <segment id='p1-6' state="initial">
72
+ <source>
73
+ (We also<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>recently surveyed 57</pc> unique organizations that switched from PDF.js to a commercial SDK. Read our<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>comprehensive guide to PDF.js</pc> to learn more.)
74
+ </source>
75
+ <target>(Nous avons &#233;galement<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>r&#233;cemment interrog&#233; 57</pc> organisations uniques qui sont pass&#233;es d&#8217;un PDF.js &#224; un SDK commercial. Lisez notre<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>guide complet sur les PDF.js</pc> pour en savoir plus.) </target>
76
+ </segment>
77
+ </unit>
78
+ <unit id="A-b4">
79
+ <!--
80
+ <fmt id="7-0" name="0" size="30.0" rise="0.0" scale="100"
81
+ colour="0206a8" colid="2" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
82
+ underline="0" strike="0" link=""/>
83
+ -->
84
+ <segment id='p1-7' state="initial">
85
+ <source>Overview </source>
86
+ <target>Aper&#231;u </target>
87
+ </segment>
88
+ </unit>
89
+ </file>
90
+ </xliff>
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3
+ <file original="../../TestFiles/translation-test.pdf" source-language="en" datatype="x-pdf" product-name="InfixXLIFF">
4
+ <header>
5
+ <tool tool-id="InfixXLIFF" tool-name="InfixXLIFF" tool-company="Apryse"/>
6
+ </header>
7
+ <body>
8
+ <!--
9
+ <cstyle id="1-0" name="0" size="12.0" rise="0.0" scale="100"
10
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
11
+ underline="0" strike="0" link=""/>
12
+ -->
13
+ <trans-unit id='p1-1' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
14
+ <source>You plan to embed PDF functionality into an application. But before you dive into the project, you must decide: do you go with a more expensive commercial PDF SDK — or a lower-cost alternative such as an open-source library or an open-source wrapper?</source>
15
+ <target>تخطط لتضمين وظائف ملفات PDF في تطبيقك. ولكن قبل أن تبدأ المشروع، عليك أن تقرر: هل ستختار حزمة تطوير برامج PDF تجارية باهظة الثمن، أم بديلاً أقل تكلفة مثل مكتبة مفتوحة المصدر أو غلاف برمجي مفتوح المصدر؟</target>
16
+ </trans-unit>
17
+
18
+ <!--
19
+ <cstyle id="2-0" name="0" size="12.0" rise="0.0" scale="100"
20
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
21
+ underline="0" strike="0" link=""/>
22
+ -->
23
+ <trans-unit id='p1-2' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
24
+ <source>There are non-trivial costs to switching later. Developers have to re-learn the new library, re-adjust the backend, customize the UI to match what users are accustomed to, as well as migrate documents, form data, annotations, and more. </source>
25
+ <target>هناك تكاليف غير تافهة للتبديل لاحقًا. يجب على المطورين إعادة تعلم المكتبة الجديدة، وإعادة ضبط الخلفية، وتخصيص واجهة المستخدم لتتناسب مع ما اعتاد عليه المستخدمون، بالإضافة إلى ترحيل المستندات وبيانات النماذج والتعليقات التوضيحية والمزيد.</target>
26
+ </trans-unit>
27
+
28
+ <!--
29
+ <cstyle id="3-0" name="0" size="12.0" rise="0.0" scale="100"
30
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
31
+ underline="0" strike="0" link=""/>
32
+
33
+ <cstyle id="3-1" name="1" size="12.0" rise="0.0" scale="100"
34
+ colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
35
+ underline="1" strike="0" link=""/>
36
+ -->
37
+ <trans-unit id='p1-3' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
38
+ <source>According to <g id='3-1' ctype='x-cstyle'>market research</g> conducted by Stax Inc., the average Net Promoter Score (NPS) for the top five PDF SDK vendors is 35%. And 70% of customers express interest in switching despite the high costs.</source>
39
+ <target>وفقًا لأبحاث السوق التي أجرتها شركة Stax Inc.، فإن متوسط درجة صافي المروجين (NPS) لأفضل خمسة بائعي SDK لملفات PDF هو 35%. ويعرب 70% من العملاء عن اهتمامهم بالتبديل على الرغم من التكاليف العالية.</target>
40
+ </trans-unit>
41
+
42
+ <!--
43
+ <cstyle id="4-0" name="0" size="12.0" rise="0.0" scale="100"
44
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
45
+ underline="0" strike="0" link=""/>
46
+ -->
47
+ <trans-unit id='p1-4' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
48
+ <source>This dissatisfaction implies that picking the right PDF SDK is a lot harder than it seems. And to help you avoid the same mistakes as past implementations, we’ve written this article.</source>
49
+ <target>يشير هذا الاستياء إلى أن اختيار حزمة تطوير برامج PDF المناسبة أصعب بكثير مما يبدو. وللمساعدة في تجنب ارتكاب نفس الأخطاء التي حدثت في التطبيقات السابقة، كتبنا هذا المقال.</target>
50
+ </trans-unit>
51
+
52
+ <!--
53
+ <cstyle id="5-0" name="0" size="12.0" rise="0.0" scale="100"
54
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
55
+ underline="0" strike="0" link=""/>
56
+
57
+ <cstyle id="5-1" name="1" size="12.0" rise="0.0" scale="100"
58
+ colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
59
+ underline="1" strike="0" link=""/>
60
+ -->
61
+ <trans-unit id='p1-5' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
62
+ <source>(We also<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>recently surveyed 57</g> unique organizations that switched from PDF.js to a commercial SDK. Read our<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>comprehensive guide to PDF.js</g> to learn more.) </source>
63
+ <target>(لقد أجرينا أيضًا مؤخرًا مسحًا شمل 57 منظمة فريدة انتقلت من PDF.js إلى SDK تجاري. اقرأ دليلنا الشامل حول PDF.js لمعرفة المزيد.)</target>
64
+ </trans-unit>
65
+
66
+ <!--
67
+ <cstyle id="6-0" name="0" size="30.0" rise="0.0" scale="100"
68
+ colour="0206a8" colid="1" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
69
+ underline="0" strike="0" link=""/>
70
+ -->
71
+ <trans-unit id='p1-6' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
72
+ <source>Overview </source>
73
+ <target>نظرة عامة</target>
74
+ </trans-unit>
75
+
76
+ </body>
77
+ </file>
78
+ </xliff>
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3
+ <file original="../../TestFiles/translation-test.pdf" source-language="en" datatype="x-pdf" product-name="InfixXLIFF">
4
+ <header>
5
+ <tool tool-id="InfixXLIFF" tool-name="InfixXLIFF" tool-company="Apryse"/>
6
+ </header>
7
+ <body>
8
+ <!--
9
+ <cstyle id="1-0" name="0" size="12.0" rise="0.0" scale="100"
10
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
11
+ underline="0" strike="0"/>
12
+ -->
13
+ <trans-unit id='p1-1' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
14
+ <source>You plan to embed PDF functionality into an application. But before you dive into the project, you must decide: do you go with a more expensive commercial PDF SDK — or a lower-cost alternative such as an open-source library or an open-source wrapper?</source>
15
+ <target>אתם מתכננים להטמיע פונקציונליות של PDF באפליקציה. אבל לפני שאתם צוללים לתוך הפרויקט, עליכם להחליט: האם אתם בוחרים ב-PDF SDK מסחרי יקר יותר - או בחלופה זולה יותר כמו ספריית קוד פתוח או עטיפת קוד פתוח?</target>
16
+ </trans-unit>
17
+
18
+ <!--
19
+ <cstyle id="2-0" name="0" size="12.0" rise="0.0" scale="100"
20
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
21
+ underline="0" strike="0"/>
22
+ -->
23
+ <trans-unit id='p1-2' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
24
+ <source>There are non-trivial costs to switching later. Developers have to re-learn the new library, re-adjust the backend, customize the UI to match what users are accustomed to, as well as migrate documents, form data, annotations, and more. </source>
25
+ <target>ישנן עלויות לא טריוויאליות למעבר מאוחר יותר. מפתחים צריכים ללמוד מחדש את הספרייה החדשה, להתאים מחדש את ה-backend, להתאים אישית את ממשק המשתמש כך שיתאים למה שהמשתמשים רגילים אליו, וכן להעביר מסמכים, נתוני טפסים, הערות ועוד.</target>
26
+ </trans-unit>
27
+
28
+ <!--
29
+ <cstyle id="3-0" name="0" size="12.0" rise="0.0" scale="100"
30
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
31
+ underline="0" strike="0"/>
32
+
33
+ <cstyle id="3-1" name="1" size="12.0" rise="0.0" scale="100"
34
+ colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
35
+ underline="1" strike="0"/>
36
+ -->
37
+ <trans-unit id='p1-3' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
38
+ <source>According to <g id='3-1' ctype='x-cstyle'>market research</g> conducted by Stax Inc., the average Net Promoter Score (NPS) for the top five PDF SDK vendors is 35%. And 70% of customers express interest in switching despite the high costs.</source>
39
+ <target>לפי מחקר שוק שערכה Stax Inc., ציון ה-Net Promoter Score (NPS) הממוצע עבור חמשת ספקי PDF SDK המובילים הוא 35%. ו-70% מהלקוחות מביעים עניין במעבר למרות העלויות הגבוהות.</target>
40
+ </trans-unit>
41
+
42
+ <!--
43
+ <cstyle id="4-0" name="0" size="12.0" rise="0.0" scale="100"
44
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
45
+ underline="0" strike="0"/>
46
+ -->
47
+ <trans-unit id='p1-4' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
48
+ <source>This dissatisfaction implies that picking the right PDF SDK is a lot harder than it seems. And to help you avoid the same mistakes as past implementations, we’ve written this article.</source>
49
+ <target>חוסר שביעות רצון זה מרמז שבחירת ערכת פיתוח התוכנה (SDK) המתאימה ל-PDF קשה הרבה יותר ממה שנדמה. וכדי לעזור לכם להימנע מאותן טעויות כמו ביישומים קודמים, כתבנו מאמר זה.</target>
50
+ </trans-unit>
51
+
52
+ <!--
53
+ <cstyle id="5-0" name="0" size="12.0" rise="0.0" scale="100"
54
+ colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
55
+ underline="0" strike="0"/>
56
+
57
+ <cstyle id="5-1" name="1" size="12.0" rise="0.0" scale="100"
58
+ colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
59
+ underline="1" strike="0"/>
60
+ -->
61
+ <trans-unit id='p1-5' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
62
+ <source>(We also<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>recently surveyed 57</g> unique organizations that switched from PDF.js to a commercial SDK. Read our<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>comprehensive guide to PDF.js</g> to learn more.) </source>
63
+ <target>(לאחרונה גם סקרנו 57 ארגונים ייחודיים שעברו מ-PDF.js ל-SDK מסחרי. קראו את המדריך המקיף שלנו ל-PDF.js למידע נוסף.)</target>
64
+ </trans-unit>
65
+
66
+ <!--
67
+ <cstyle id="6-0" name="0" size="30.0" rise="0.0" scale="100"
68
+ colour="0206a8" colid="1" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
69
+ underline="0" strike="0"/>
70
+ -->
71
+ <trans-unit id='p1-6' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
72
+ <source>Overview </source>
73
+ <target>סקירה כללית</target>
74
+ </trans-unit>
75
+
76
+ </body>
77
+ </file>
78
+ </xliff>
Binary file
@@ -0,0 +1,71 @@
1
+ //---------------------------------------------------------------------------------------
2
+ // Copyright (c) 2001-2026 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 + 'translation-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
+ // Optionally, flip the text boxes, vector artwork and images on the page to retain continuity.
45
+ // options.SetFlipPageContentsForBiDirectionalTranslations(true);
46
+
47
+ // Extract the xlf to file and field the PDF for translation
48
+ await PDFNet.TransPDF.extractXLIFF(doc, outputPath + 'translation-test-arabic.xlf', options);
49
+
50
+ // Save the fielded PDF
51
+ await doc.save(outputPath + 'translation-test-arabic-fielded.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
52
+
53
+ // The extracted xlf can be translated in a system of your choice.
54
+ // In this sample a pre-prepared translated file is used - translation-test-(en_to_ar).xlf
55
+
56
+ // Perform the translation using the pre-prepared translated xliff
57
+ await PDFNet.TransPDF.applyXLIFF(doc, inputPath + "translation-test-(en_to_ar).xlf", options);
58
+
59
+ await doc.save(outputPath + 'translation-test-arabic.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
60
+
61
+ await PDFNet.endDeallocateStack();
62
+ } catch (err) {
63
+ console.log(err.stack);
64
+ }
65
+ };
66
+ PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function (error) { console.log('Error: ' + JSON.stringify(error)); }).then(function () { return PDFNet.shutdown(); });
67
+ };
68
+ exports.runTransPDF();
69
+ })(exports);
70
+ // eslint-disable-next-line spaced-comment
71
+ //# sourceURL=TransPDF.js
@@ -0,0 +1,71 @@
1
+ //---------------------------------------------------------------------------------------
2
+ // Copyright (c) 2001-2026 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 + 'translation-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
+ // Optionally, flip the text boxes, vector artwork and images on the page to retain continuity.
45
+ // options.SetFlipPageContentsForBiDirectionalTranslations(true);
46
+
47
+ // Extract the xlf to file and field the PDF for translation
48
+ await PDFNet.TransPDF.extractXLIFF(doc, outputPath + 'translation-test-hebrew.xlf', options);
49
+
50
+ // Save the fielded PDF
51
+ await doc.save(outputPath + 'translation-test-hebrew-fielded.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
52
+
53
+ // The extracted xlf can be translated in a system of your choice.
54
+ // In this sample a pre-prepared translated file is used - translation-test-(en_to_he).xlf
55
+
56
+ // Perform the translation using the pre-prepared translated xliff
57
+ await PDFNet.TransPDF.applyXLIFF(doc, inputPath + "translation-test-(en_to_he).xlf", options);
58
+
59
+ await doc.save(outputPath + 'translation-test-hebrew.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
60
+
61
+ await PDFNet.endDeallocateStack();
62
+ } catch (err) {
63
+ console.log(err.stack);
64
+ }
65
+ };
66
+ PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function (error) { console.log('Error: ' + JSON.stringify(error)); }).then(function () { return PDFNet.shutdown(); });
67
+ };
68
+ exports.runTransPDF();
69
+ })(exports);
70
+ // eslint-disable-next-line spaced-comment
71
+ //# sourceURL=TransPDF.js
@@ -56,6 +56,9 @@ const PDFTronLicense = require('../LicenseKey/LicenseKey');
56
56
  // Perform the translation using the pre-prepared translated xliff
57
57
  await PDFNet.TransPDF.applyXLIFF(doc, inputPath + "find-replace-test_(en_to_fr).xlf", options);
58
58
 
59
+ // Comment out the above line and uncomment the below line to perform the translation using XLIFF 2.
60
+ // await PDFNet.TransPDF.applyXLIFF(doc, inputPath + "find-replace-test_(en_to_fr)-2.xlf", options);
61
+
59
62
  await doc.save(outputPath + 'find-replace-test-fr.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
60
63
 
61
64
  await PDFNet.endDeallocateStack();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdftron/pdfnet-node-samples",
3
- "version": "11.13.0",
3
+ "version": "12.0.0-beta",
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.apryse.com",
14
14
  "dependencies": {
15
- "@pdftron/pdfnet-node": "^11.13.0",
15
+ "@pdftron/pdfnet-node": "^12.0.0-beta",
16
16
  "run-script-os": "^1.1.6",
17
17
  "underscore": "^1.13.6",
18
18
  "xhr2": "^0.2.1"