@pdftron/pdfnet-node-samples 9.1.0-beta → 9.2.0-2
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 +18 -18
- package/readme.md +5 -3
- package/samples/AddImageTest/AddImageTest.js +115 -115
- package/samples/AdvancedImagingTest/AdvancedImagingTest.js +64 -64
- package/samples/AnnotationTest/AnnotationTest.js +641 -641
- package/samples/BookmarkTest/BookmarkTest.js +219 -219
- package/samples/CAD2PDFTest/CAD2PDFTest.js +3 -3
- package/samples/ContentReplacerTest/ContentReplacerTest.js +75 -75
- package/samples/ConvertTest/ConvertTest.js +2 -2
- package/samples/DigitalSignaturesTest/DigitalSignaturesTest.js +2 -2
- package/samples/ElementBuilderTest/ElementBuilderTest.js +513 -513
- package/samples/ElementEditTest/ElementEditTest.js +110 -110
- package/samples/ElementReaderAdvTest/ElementReaderAdvTest.js +305 -305
- package/samples/ElementReaderTest/ElementReaderTest.js +77 -77
- package/samples/EncTest/EncTest.js +175 -175
- package/samples/FDFTest/FDFTest.js +2 -2
- package/samples/HTML2PDFTest/HTML2PDFTest.js +54 -44
- package/samples/ImageExtractTest/ImageExtractTest.js +2 -2
- package/samples/ImpositionTest/ImpositionTest.js +2 -2
- package/samples/InteractiveFormsTest/InteractiveFormsTest.js +2 -2
- package/samples/JBIG2Test/JBIG2Test.js +3 -3
- package/samples/LicenseKey/LicenseKey.js +11 -11
- package/samples/LogicalStructureTest/LogicalStructureTest.js +250 -250
- package/samples/OCRTest/OCRTest.js +2 -2
- package/samples/OfficeTemplateTest/OfficeTemplateTest.js +76 -0
- package/samples/OfficeToPDFTest/OfficeToPDFTest.js +2 -2
- package/samples/OptimizerTest/OptimizerTest.js +2 -2
- package/samples/PDF2HtmlTest/PDF2HtmlTest.js +123 -117
- package/samples/PDF2OfficeTest/PDF2OfficeTest.js +158 -0
- package/samples/PDFATest/PDFATest.js +85 -85
- package/samples/PDFDocMemoryTest/PDFDocMemoryTest.js +2 -2
- package/samples/PDFDrawTest/PDFDrawTest.js +305 -305
- package/samples/PDFLayersTest/PDFLayersTest.js +294 -294
- package/samples/PDFPackageTest/PDFPackageTest.js +3 -3
- package/samples/PDFPageTest/PDFPageTest.js +189 -189
- package/samples/PDFRedactTest/PDFRedactTest.js +74 -74
- package/samples/PageLabelsTest/PageLabelsTest.js +2 -2
- package/samples/PatternTest/PatternTest.js +2 -2
- package/samples/RectTest/RectTest.js +40 -40
- package/samples/SDFTest/SDFTest.js +88 -88
- package/samples/StamperTest/StamperTest.js +255 -255
- package/samples/TestFiles/Misc-Fixed.pfa +1166 -1166
- package/samples/TestFiles/SHA-2 Root USERTrust RSA CA Sectigo timestamping.crt +34 -34
- package/samples/TestFiles/form1_annots.xfdf +33 -33
- package/samples/TestFiles/form1_data.xfdf +139 -139
- package/samples/TestFiles/my_stream.txt +2310 -2310
- package/samples/TextExtractTest/TextExtractTest.js +286 -286
- package/samples/TextSearchTest/TextSearchTest.js +121 -121
- package/samples/U3DTest/U3DTest.js +2 -2
- package/samples/UndoRedoTest/UndoRedoTest.js +101 -101
- package/samples/UnicodeWriteTest/UnicodeWriteTest.js +173 -173
- package/samples/WebViewerConvertTest/WebViewerConvertTest.js +2 -2
- package/samples/runall.bat +3 -4
- package/samples/runall.sh +4 -3
- package/samples/AddImageTest/RunTest.bat +0 -2
- package/samples/AddImageTest/RunTest.sh +0 -2
- package/samples/AdvancedImagingTest/RunTest.bat +0 -2
- package/samples/AdvancedImagingTest/RunTest.sh +0 -2
- package/samples/AnnotationTest/RunTest.bat +0 -2
- package/samples/AnnotationTest/RunTest.sh +0 -2
- package/samples/BookmarkTest/RunTest.bat +0 -2
- package/samples/BookmarkTest/RunTest.sh +0 -2
- package/samples/CAD2PDFTest/RunTest.bat +0 -2
- package/samples/CAD2PDFTest/RunTest.sh +0 -2
- package/samples/ContentReplacerTest/RunTest.bat +0 -2
- package/samples/ContentReplacerTest/RunTest.sh +0 -2
- package/samples/ConvertTest/RunTest.bat +0 -2
- package/samples/ConvertTest/RunTest.sh +0 -2
- package/samples/DigitalSignaturesTest/RunTest.bat +0 -2
- package/samples/DigitalSignaturesTest/RunTest.sh +0 -2
- package/samples/ElementBuilderTest/RunTest.bat +0 -2
- package/samples/ElementBuilderTest/RunTest.sh +0 -2
- package/samples/ElementEditTest/RunTest.bat +0 -2
- package/samples/ElementEditTest/RunTest.sh +0 -2
- package/samples/ElementReaderAdvTest/RunTest.bat +0 -2
- package/samples/ElementReaderAdvTest/RunTest.sh +0 -2
- package/samples/ElementReaderTest/RunTest.bat +0 -2
- package/samples/ElementReaderTest/RunTest.sh +0 -2
- package/samples/EncTest/RunTest.bat +0 -2
- package/samples/EncTest/RunTest.sh +0 -2
- package/samples/FDFTest/RunTest.bat +0 -2
- package/samples/FDFTest/RunTest.sh +0 -2
- package/samples/HTML2PDFTest/RunTest.bat +0 -2
- package/samples/HTML2PDFTest/RunTest.sh +0 -2
- package/samples/ImageExtractTest/RunTest.bat +0 -2
- package/samples/ImageExtractTest/RunTest.sh +0 -2
- package/samples/ImpositionTest/RunTest.bat +0 -2
- package/samples/ImpositionTest/RunTest.sh +0 -2
- package/samples/InteractiveFormsTest/RunTest.bat +0 -2
- package/samples/InteractiveFormsTest/RunTest.sh +0 -2
- package/samples/JBIG2Test/RunTest.bat +0 -2
- package/samples/JBIG2Test/RunTest.sh +0 -2
- package/samples/LogicalStructureTest/RunTest.bat +0 -2
- package/samples/LogicalStructureTest/RunTest.sh +0 -2
- package/samples/OCRTest/RunTest.bat +0 -2
- package/samples/OCRTest/RunTest.sh +0 -2
- package/samples/OfficeToPDFTest/RunTest.bat +0 -2
- package/samples/OfficeToPDFTest/RunTest.sh +0 -2
- package/samples/OptimizerTest/RunTest.bat +0 -2
- package/samples/OptimizerTest/RunTest.sh +0 -2
- package/samples/PDF2HtmlTest/RunTest.bat +0 -2
- package/samples/PDF2HtmlTest/RunTest.sh +0 -2
- package/samples/PDF2WordTest/PDF2WordTest.js +0 -85
- package/samples/PDF2WordTest/RunTest.bat +0 -2
- package/samples/PDF2WordTest/RunTest.sh +0 -2
- package/samples/PDFATest/RunTest.bat +0 -2
- package/samples/PDFATest/RunTest.sh +0 -2
- package/samples/PDFDocMemoryTest/RunTest.bat +0 -2
- package/samples/PDFDocMemoryTest/RunTest.sh +0 -2
- package/samples/PDFDrawTest/RunTest.bat +0 -2
- package/samples/PDFDrawTest/RunTest.sh +0 -2
- package/samples/PDFLayersTest/RunTest.bat +0 -2
- package/samples/PDFLayersTest/RunTest.sh +0 -2
- package/samples/PDFPackageTest/RunTest.bat +0 -2
- package/samples/PDFPackageTest/RunTest.sh +0 -2
- package/samples/PDFPageTest/RunTest.bat +0 -2
- package/samples/PDFPageTest/RunTest.sh +0 -2
- package/samples/PDFRedactTest/RunTest.bat +0 -2
- package/samples/PDFRedactTest/RunTest.sh +0 -2
- package/samples/PageLabelsTest/RunTest.bat +0 -2
- package/samples/PageLabelsTest/RunTest.sh +0 -2
- package/samples/PatternTest/RunTest.bat +0 -2
- package/samples/PatternTest/RunTest.sh +0 -2
- package/samples/RectTest/RunTest.bat +0 -2
- package/samples/RectTest/RunTest.sh +0 -2
- package/samples/SDFTest/RunTest.bat +0 -2
- package/samples/SDFTest/RunTest.sh +0 -2
- package/samples/StamperTest/RunTest.bat +0 -2
- package/samples/StamperTest/RunTest.sh +0 -2
- package/samples/TextExtractTest/RunTest.bat +0 -2
- package/samples/TextExtractTest/RunTest.sh +0 -2
- package/samples/TextSearchTest/RunTest.bat +0 -2
- package/samples/TextSearchTest/RunTest.sh +0 -2
- package/samples/U3DTest/RunTest.bat +0 -2
- package/samples/U3DTest/RunTest.sh +0 -2
- package/samples/UndoRedoTest/RunTest.bat +0 -2
- package/samples/UndoRedoTest/RunTest.sh +0 -2
- package/samples/UnicodeWriteTest/RunTest.bat +0 -2
- package/samples/UnicodeWriteTest/RunTest.sh +0 -2
- package/samples/WebViewerConvertTest/RunTest.bat +0 -2
- package/samples/WebViewerConvertTest/RunTest.sh +0 -2
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
//---------------------------------------------------------------------------------------
|
|
22
22
|
|
|
23
23
|
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
24
|
-
|
|
24
|
+
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
25
25
|
|
|
26
26
|
((exports) => {
|
|
27
27
|
'use strict';
|
|
@@ -29,17 +29,28 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
29
29
|
exports.runHTML2PDFTest = () => {
|
|
30
30
|
const main = async () => {
|
|
31
31
|
const outputPath = '../TestFiles/Output/html2pdf_example';
|
|
32
|
-
const host = '
|
|
33
|
-
const page0 = '
|
|
34
|
-
const page1 = '
|
|
35
|
-
const page2 = '
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// PDFNet library, or in the current working directory, it will be loaded
|
|
40
|
-
// automatically. Otherwise, it must be set manually using HTML2PDF.setModulePath.
|
|
32
|
+
const host = 'https://www.pdftron.com';
|
|
33
|
+
const page0 = '/';
|
|
34
|
+
const page1 = '/support';
|
|
35
|
+
const page2 = '/blog';
|
|
36
|
+
// For HTML2PDF we need to locate the html2pdf module. If placed with the
|
|
37
|
+
// PDFNet library, or in the current working directory, it will be loaded
|
|
38
|
+
// automatically. Otherwise, it must be set manually using HTML2PDF.setModulePath.
|
|
41
39
|
await PDFNet.HTML2PDF.setModulePath('../../lib/');
|
|
42
40
|
|
|
41
|
+
try {
|
|
42
|
+
if(await !PDFNet.HTML2PDF.isModuleAvailable()){
|
|
43
|
+
console.log('Unable to run HTML2PDFTest: PDFTron SDK HTML2PDF module not available.');
|
|
44
|
+
console.log('---------------------------------------------------------------');
|
|
45
|
+
console.log('The HTML2PDF module is an optional add-on, available for download');
|
|
46
|
+
console.log('at https://www.pdftron.com/. If you have already downloaded this');
|
|
47
|
+
console.log('module, ensure that the SDK is able to find the required files');
|
|
48
|
+
console.log('using the HTML2PDF.setModulePath() function.');
|
|
49
|
+
}
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.log(err);
|
|
52
|
+
}
|
|
53
|
+
|
|
43
54
|
//--------------------------------------------------------------------------------
|
|
44
55
|
// Example 1) Simple conversion of a web page to a PDF doc.
|
|
45
56
|
|
|
@@ -69,16 +80,16 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
69
80
|
|
|
70
81
|
// create the HTML2PDF converter object and modify the output of the PDF pages
|
|
71
82
|
const html2pdf = await PDFNet.HTML2PDF.create();
|
|
72
|
-
html2pdf.setImageQuality(25);
|
|
73
83
|
html2pdf.setPaperSize(PDFNet.PrinterMode.PaperSize.e_11x17);
|
|
74
84
|
|
|
75
85
|
// insert the web page to convert
|
|
76
86
|
html2pdf.insertFromUrl(host.concat(page0));
|
|
87
|
+
|
|
77
88
|
// convert the web page, appending generated PDF pages to doc
|
|
78
89
|
if (await html2pdf.convert(doc)) {
|
|
79
90
|
doc.save(outputPath.concat('_02.pdf'), PDFNet.SDFDoc.SaveOptions.e_linearized);
|
|
80
91
|
} else {
|
|
81
|
-
console.log('
|
|
92
|
+
console.log('Conversion failed. HTTP Code: ' + await html2pdf.getHttpErrorCode());
|
|
82
93
|
console.log(await html2pdf.getLog());
|
|
83
94
|
}
|
|
84
95
|
} catch (err) {
|
|
@@ -86,41 +97,40 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
86
97
|
}
|
|
87
98
|
|
|
88
99
|
//--------------------------------------------------------------------------------
|
|
89
|
-
// Example 3) Convert multiple web pages
|
|
90
|
-
// the first page as a cover page, not to be included with the table of contents outline.
|
|
100
|
+
// Example 3) Convert multiple web pages
|
|
91
101
|
|
|
92
102
|
try {
|
|
93
|
-
//
|
|
94
|
-
const
|
|
95
|
-
cover.setLoadErrorHandling(PDFNet.HTML2PDF.WebPageSettings.ErrorHandling.e_ignore);
|
|
96
|
-
await cover.setIncludeInOutline(false);
|
|
97
|
-
|
|
98
|
-
const html2pdf = await PDFNet.HTML2PDF.create();
|
|
99
|
-
html2pdf.insertFromUrl2(host.concat(page3), cover);
|
|
100
|
-
|
|
101
|
-
// Add a table of contents settings (modifying the settings is optional)
|
|
102
|
-
const toc = await PDFNet.HTML2PDF.TOCSettings.create();
|
|
103
|
-
await toc.setDottedLines(false);
|
|
104
|
-
html2pdf.insertTOC2(toc);
|
|
105
|
-
|
|
106
|
-
// Now add the rest of the web pages, disabling external links and
|
|
107
|
-
// skipping any web pages that fail to load.
|
|
108
|
-
//
|
|
109
|
-
// Note that the order of insertion matters, so these will appear
|
|
110
|
-
// after the cover and table of contents, in the order below.
|
|
111
|
-
const settings = await PDFNet.HTML2PDF.WebPageSettings.create();
|
|
112
|
-
settings.setLoadErrorHandling(PDFNet.HTML2PDF.WebPageSettings.ErrorHandling.e_skip);
|
|
113
|
-
await settings.setExternalLinks(false);
|
|
103
|
+
// convert page 0 into pdf
|
|
104
|
+
const doc = await PDFNet.PDFDoc.create();
|
|
114
105
|
|
|
115
|
-
|
|
116
|
-
html2pdf.insertFromUrl2(host.concat(page1), settings);
|
|
117
|
-
html2pdf.insertFromUrl2(host.concat(page2), settings);
|
|
106
|
+
const converter = await PDFNet.HTML2PDF.create();
|
|
118
107
|
|
|
119
|
-
const
|
|
120
|
-
|
|
108
|
+
const header = '<div style=\'width:15%;margin-left:0.5cm;text-align:left;font-size:10px;color:#0000FF\'><span class=\'date\'></span></div><div style=\'width:70%;direction:rtl;white-space:nowrap;overflow:hidden;text-overflow:clip;text-align:center;font-size:10px;color:#0000FF\'><span>PDFTRON HEADER EXAMPLE</span></div><div style=\'width:15%;margin-right:0.5cm;text-align:right;font-size:10px;color:#0000FF\'><span class=\'pageNumber\'></span> of <span class=\'totalPages\'></span></div>';
|
|
109
|
+
const footer = '<div style=\'width:15%;margin-left:0.5cm;text-align:left;font-size:7px;color:#FF00FF\'><span class=\'date\'></span></div><div style=\'width:70%;direction:rtl;white-space:nowrap;overflow:hidden;text-overflow:clip;text-align:center;font-size:7px;color:#FF00FF\'><span>PDFTRON FOOTER EXAMPLE</span></div><div style=\'width:15%;margin-right:0.5cm;text-align:right;font-size:7px;color:#FF00FF\'><span class=\'pageNumber\'></span> of <span class=\'totalPages\'></span></div>';
|
|
110
|
+
converter.setHeader(header);
|
|
111
|
+
converter.setFooter(footer);
|
|
112
|
+
converter.setMargins('1cm', '2cm', '.5cm', '1.5cm');
|
|
113
|
+
const settings = await PDFNet.HTML2PDF.WebPageSettings.create();
|
|
114
|
+
await settings.setZoom(0.5);
|
|
115
|
+
converter.insertFromUrl2(host.concat(page0), settings);
|
|
116
|
+
const is_conversion_0_successful = await converter.convert(doc);
|
|
117
|
+
|
|
118
|
+
// convert page 1 with the same settings, appending generated PDF pages to doc
|
|
119
|
+
converter.insertFromUrl2(host.concat(page1), settings);
|
|
120
|
+
const is_conversion_1_successful = await converter.convert(doc);
|
|
121
|
+
|
|
122
|
+
// convert page 2 with different settings, appending generated PDF pages to doc
|
|
123
|
+
const another_converter = await PDFNet.HTML2PDF.create();
|
|
124
|
+
another_converter.setLandscape(true);
|
|
125
|
+
const another_settings = await PDFNet.HTML2PDF.WebPageSettings.create();
|
|
126
|
+
another_settings.setPrintBackground(false);
|
|
127
|
+
another_converter.insertFromUrl2(host.concat(page2), another_settings);
|
|
128
|
+
const is_conversion_2_successful = await another_converter.convert(doc);
|
|
129
|
+
|
|
130
|
+
if(is_conversion_0_successful && is_conversion_1_successful && is_conversion_2_successful) {
|
|
121
131
|
doc.save(outputPath.concat('_03.pdf'), PDFNet.SDFDoc.SaveOptions.e_linearized);
|
|
122
132
|
} else {
|
|
123
|
-
console.log('
|
|
133
|
+
console.log('Conversion failed. HTTP Code: ' + await html2pdf.getHttpErrorCode());
|
|
124
134
|
console.log(await html2pdf.getLog());
|
|
125
135
|
}
|
|
126
136
|
} catch (err) {
|
|
@@ -133,13 +143,13 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
133
143
|
try {
|
|
134
144
|
const html2pdf = await PDFNet.HTML2PDF.create();
|
|
135
145
|
const doc = await PDFNet.PDFDoc.create();
|
|
136
|
-
const html = '<html><body><h1>Heading</h1><p>Paragraph.</p></body></html>'
|
|
146
|
+
const html = '<html><body><h1>Heading</h1><p>Paragraph.</p></body></html>';
|
|
137
147
|
|
|
138
148
|
html2pdf.insertFromHtmlString(html);
|
|
139
149
|
if (await html2pdf.convert(doc)) {
|
|
140
150
|
doc.save(outputPath.concat('_04.pdf'), PDFNet.SDFDoc.SaveOptions.e_linearized);
|
|
141
151
|
} else {
|
|
142
|
-
console.log('
|
|
152
|
+
console.log('Conversion failed. HTTP Code: ' + await html2pdf.getHttpErrorCode());
|
|
143
153
|
console.log(await html2pdf.getLog());
|
|
144
154
|
}
|
|
145
155
|
} catch (err) {
|
|
@@ -150,7 +160,7 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
150
160
|
}
|
|
151
161
|
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error) {
|
|
152
162
|
console.log('Error: ' + JSON.stringify(error));
|
|
153
|
-
}).then(function(){ PDFNet.shutdown(); });
|
|
163
|
+
}).then(function(){ return PDFNet.shutdown(); });
|
|
154
164
|
};
|
|
155
165
|
exports.runHTML2PDFTest();
|
|
156
166
|
})(exports);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
//-----------------------------------------------------------------------------------
|
|
15
15
|
|
|
16
16
|
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
17
|
-
|
|
17
|
+
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
18
18
|
|
|
19
19
|
((exports) => {
|
|
20
20
|
'use strict';
|
|
@@ -122,7 +122,7 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
122
122
|
}
|
|
123
123
|
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error) {
|
|
124
124
|
console.log('Error: ' + JSON.stringify(error));
|
|
125
|
-
}).then(function(){ PDFNet.shutdown(); });
|
|
125
|
+
}).then(function(){ return PDFNet.shutdown(); });
|
|
126
126
|
};
|
|
127
127
|
exports.runImageExtractTest();
|
|
128
128
|
})(exports);
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//-----------------------------------------------------------------------------------
|
|
14
14
|
|
|
15
15
|
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
16
|
-
|
|
16
|
+
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
17
17
|
|
|
18
18
|
((exports) => {
|
|
19
19
|
'use strict';
|
|
@@ -79,7 +79,7 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
79
79
|
}
|
|
80
80
|
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error) {
|
|
81
81
|
console.log('Error: ' + JSON.stringify(error));
|
|
82
|
-
}).then(function(){ PDFNet.shutdown(); });
|
|
82
|
+
}).then(function(){ return PDFNet.shutdown(); });
|
|
83
83
|
};
|
|
84
84
|
exports.runImpositionTest();
|
|
85
85
|
})(exports);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// forms (also known as AcroForms).
|
|
9
9
|
//---------------------------------------------------------------------------------------
|
|
10
10
|
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
11
|
-
|
|
11
|
+
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
12
12
|
|
|
13
13
|
((exports) => {
|
|
14
14
|
'use strict';
|
|
@@ -374,7 +374,7 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
374
374
|
};
|
|
375
375
|
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function (error) {
|
|
376
376
|
console.log('Error: ' + JSON.stringify(error));
|
|
377
|
-
}).then(function () { PDFNet.shutdown(); });
|
|
377
|
+
}).then(function () { return PDFNet.shutdown(); });
|
|
378
378
|
};
|
|
379
379
|
exports.runInteractiveFormsTest();
|
|
380
380
|
})(exports);
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
//
|
|
14
14
|
|
|
15
15
|
const { PDFNet } = require('@pdftron/pdfnet-node');
|
|
16
|
-
|
|
16
|
+
const PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
17
17
|
|
|
18
18
|
((exports) => {
|
|
19
19
|
'use strict';
|
|
@@ -30,7 +30,7 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
30
30
|
const obj = await cos_doc.getObj(i);
|
|
31
31
|
if (obj && !(await obj.isFree()) && await obj.isStream()) {
|
|
32
32
|
// Process only images
|
|
33
|
-
|
|
33
|
+
let itr = await obj.find('Subtype');
|
|
34
34
|
if (!(await itr.hasNext()) || await (await itr.value()).getName() !== 'Image')
|
|
35
35
|
continue;
|
|
36
36
|
const input_image = await PDFNet.Image.createFromObj(obj);
|
|
@@ -81,7 +81,7 @@ var PDFTronLicense = require('../LicenseKey/LicenseKey');
|
|
|
81
81
|
};
|
|
82
82
|
PDFNet.runWithCleanup(main, PDFTronLicense.Key).catch(function(error) {
|
|
83
83
|
console.log('Error: ' + JSON.stringify(error));
|
|
84
|
-
}).then(function(){ PDFNet.shutdown(); });
|
|
84
|
+
}).then(function(){ return PDFNet.shutdown(); });
|
|
85
85
|
};
|
|
86
86
|
exports.runJBIG2Test();
|
|
87
87
|
})(exports);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//---------------------------------------------------------------------------------------
|
|
2
|
-
// Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved.
|
|
3
|
-
// Consult legal.txt regarding legal and license information.
|
|
4
|
-
//---------------------------------------------------------------------------------------
|
|
5
|
-
|
|
6
|
-
//"Enter your key here. If you don't have it, 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.
|
|
7
|
-
const LicenseKey = 'YOUR_PDFTRON_LICENSE_KEY';
|
|
8
|
-
if(LicenseKey == 'YOUR_PDFTRON_LICENSE_KEY'){
|
|
9
|
-
throw ('Please enter your license key by replacing \'YOUR_PDFTRON_LICENSE_KEY\' that is assigned to the LicenseKey variable in Samples/LicenseKey/LicenseKey.js. If you do not have a license key, 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.');
|
|
10
|
-
}
|
|
11
|
-
exports.Key = LicenseKey;
|
|
1
|
+
//---------------------------------------------------------------------------------------
|
|
2
|
+
// Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved.
|
|
3
|
+
// Consult legal.txt regarding legal and license information.
|
|
4
|
+
//---------------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
//"Enter your key here. If you don't have it, 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.
|
|
7
|
+
const LicenseKey = 'YOUR_PDFTRON_LICENSE_KEY';
|
|
8
|
+
if(LicenseKey == 'YOUR_PDFTRON_LICENSE_KEY'){
|
|
9
|
+
throw ('Please enter your license key by replacing \'YOUR_PDFTRON_LICENSE_KEY\' that is assigned to the LicenseKey variable in Samples/LicenseKey/LicenseKey.js. If you do not have a license key, 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.');
|
|
10
|
+
}
|
|
11
|
+
exports.Key = LicenseKey;
|