asposepdfnodejs 24.2.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.
package/example.mjs ADDED
@@ -0,0 +1,269 @@
1
+ import AsposePdf from './AsposePDFforNode.mjs';
2
+ import fs from 'fs';
3
+ import os from 'os';
4
+
5
+ const pdf_file = './ReadMe.pdf';
6
+ const aspose_file = './Aspose.jpg';
7
+ const resultdir = !!process.platform.match(/^win/) ? '' : fs.realpathSync(os.tmpdir()) + '/';
8
+
9
+ console.log('Aspose.PDF for Node.js via C++ example');
10
+
11
+ const AsposePdfModule = await AsposePdf();
12
+
13
+ console.log('Result dir: %O', resultdir);
14
+
15
+ let json;
16
+
17
+ /*About*/
18
+ console.log("Miscellaneous:");
19
+
20
+ //AsposePdfAbout - Get info about Product
21
+ json = AsposePdfModule.AsposePdfAbout();
22
+ console.log("01. AsposePdfAbout => %O", json.errorCode == 0 ? JSON.parse(JSON.stringify(json).replace('"errorCode":0,"errorText":"",','')) : json.errorText);
23
+
24
+ /*Convert from PDF*/
25
+ console.log("Convert from PDF:");
26
+
27
+ //AsposePdfPagesToJpg - Convert a PDF-file to JPG
28
+ json = AsposePdfModule.AsposePdfPagesToJpg(pdf_file, resultdir + "ResultPdfToJpg{0:D2}.jpg", 150);
29
+ console.log("01. AsposePdfPagesToJpg => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
30
+
31
+ //AsposePdfPagesToPng - Convert a PDF-file to PNG
32
+ json = AsposePdfModule.AsposePdfPagesToPng(pdf_file, resultdir + "ResultPdfToPng{0:D2}.png", 150);
33
+ console.log("02. AsposePdfPagesToPng => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
34
+
35
+ //AsposePdfPagesToTiff - Convert a PDF-file to TIFF
36
+ json = AsposePdfModule.AsposePdfPagesToTiff(pdf_file, resultdir + "ResultPdfToTiff{0:D2}.tiff", 300);
37
+ console.log("03. AsposePdfPagesToTiff => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
38
+
39
+ //AsposePdfPagesToBmp - Convert a PDF-file to BMP
40
+ json = AsposePdfModule.AsposePdfPagesToBmp(pdf_file, resultdir + "ResultPdfToBmp{0:D2}.bmp", 150);
41
+ console.log("04. AsposePdfPagesToBmp => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
42
+
43
+ //AsposePdfPagesToDICOM - Convert a PDF-file to DICOM
44
+ json = AsposePdfModule.AsposePdfPagesToDICOM(pdf_file, resultdir + "ResultPdfToDICOM{0:D2}.dcm", 150);
45
+ console.log("05. AsposePdfPagesToDICOM => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
46
+
47
+ //AsposePdfPagesToSvg - Convert a PDF-file to SVG
48
+ json = AsposePdfModule.AsposePdfPagesToSvg(pdf_file, resultdir + "ResultPdfToSvg.svg");
49
+ console.log("06. AsposePdfPagesToSvg => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
50
+
51
+ //AsposePdfPagesToSvgZip - Convert a PDF-file to SVG(zip)
52
+ json = AsposePdfModule.AsposePdfPagesToSvgZip(pdf_file, resultdir + "ResultPdfToSvgZip.zip");
53
+ console.log("07. AsposePdfPagesToSvgZip => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
54
+
55
+ //AsposePdfToTeX - Convert a PDF-file to TeX
56
+ json = AsposePdfModule.AsposePdfToTeX(pdf_file, resultdir + "ResultPdfToTeX.tex");
57
+ console.log("08. AsposePdfToTeX => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
58
+
59
+ //AsposePdfToXps - Convert a PDF-file to Xps
60
+ json = AsposePdfModule.AsposePdfToXps(pdf_file, resultdir + "ResultPdfToXps.xps");
61
+ console.log("09. AsposePdfToXps => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
62
+
63
+ //AsposePdfTablesToCSV - Convert a PDF-file to CSV (extract tables)
64
+ json = AsposePdfModule.AsposePdfTablesToCSV(pdf_file, resultdir + "ResultPdfTablesToCSV{0:D2}.csv", "\t");
65
+ console.log("10. AsposePdfTablesToCSV => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
66
+
67
+ //AsposePdfToTxt - Convert a PDF-file to Txt
68
+ json = AsposePdfModule.AsposePdfToTxt(pdf_file, resultdir + "ResultPdfToTxt.txt");
69
+ console.log("11. AsposePdfToTxt => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
70
+
71
+ //AsposePdfConvertToGrayscale - Convert a PDF-file to grayscale
72
+ json = AsposePdfModule.AsposePdfConvertToGrayscale(pdf_file, resultdir + "ResultConvertToGrayscale.pdf");
73
+ console.log("12. AsposePdfConvertToGrayscale => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
74
+
75
+ //AsposePdfConvertToPDFA - Convert a PDF-file to PDF/A
76
+ json = AsposePdfModule.AsposePdfConvertToPDFA(pdf_file,AsposePdfModule.PdfFormat.PDF_A_1A, resultdir + "ResultConvertToPDFA.pdf", resultdir + "ResultConvertToPDFALog.xml");
77
+ console.log("13. AsposePdfConvertToPDFA => %O", json.errorCode == 0 ? [json.fileNameResult, json.fileNameLogResult] : json.errorText);
78
+
79
+ //AsposePdfAConvertToPDF - Convert a PDF/A-file to PDF
80
+ json = AsposePdfModule.AsposePdfAConvertToPDF(resultdir + "ResultConvertToPDFA.pdf", resultdir + "ResultConvertToPDF.pdf");
81
+ console.log("14. AsposePdfAConvertToPDF => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
82
+
83
+ //AsposePdfToDocX - Convert a PDF-file to DocX
84
+ json = AsposePdfModule.AsposePdfToDocX(pdf_file, resultdir + "ResultPdfToDocX.docx");
85
+ console.log("15. AsposePdfToDocX => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
86
+
87
+ //AsposePdfToXlsX - Convert a PDF-file to XlsX
88
+ json = AsposePdfModule.AsposePdfToXlsX(pdf_file, resultdir + "ResultPdfToXlsX.xlsx");
89
+ console.log("16. AsposePdfToXlsX => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
90
+
91
+ //AsposePdfToEPUB - Convert a PDF-file to ePub
92
+ json = AsposePdfModule.AsposePdfToEPUB(pdf_file, resultdir + "ResultPdfToEPUB.epub");
93
+ console.log("17. AsposePdfToEPUB => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
94
+
95
+ //AsposePdfToDoc - Convert a PDF-file to Doc
96
+ json = AsposePdfModule.AsposePdfToDoc(pdf_file, resultdir + "ResultPdfToDoc.doc");
97
+ console.log("18. AsposePdfToDoc => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
98
+
99
+ //AsposePdfToPptX - Convert a PDF-file to PptX
100
+ json = AsposePdfModule.AsposePdfToPptX(pdf_file, resultdir + "ResultPdfToPptX.pptx");
101
+ console.log("19. AsposePdfToPptX => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
102
+
103
+ //AsposePdfExtractText - Extract text from a PDF-file
104
+ json = AsposePdfModule.AsposePdfExtractText(pdf_file);
105
+ console.log("20. AsposePdfExtractText => %O", json.errorCode == 0 ? json.extractText.split('\n')[1] : json.errorText);
106
+
107
+ //AsposePdfExtractImage - Extract image from a PDF-file
108
+ json = AsposePdfModule.AsposePdfExtractImage(pdf_file, resultdir + "ResultPdfExtractImage{0:D2}.jpg", 150);
109
+ console.log("21. AsposePdfExtractImage => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
110
+
111
+ //AsposePdfExportFdf - Export from a PDF-file with AcroForm to FDF
112
+ json = AsposePdfModule.AsposePdfExportFdf(pdf_file, resultdir + "ResultPdfExportFdf.fdf");
113
+ console.log("22. AsposePdfExportFdf => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
114
+
115
+ //AsposePdfExportXfdf - Export from a PDF-file with AcroForm to XFDF
116
+ json = AsposePdfModule.AsposePdfExportXfdf(pdf_file, resultdir + "ResultPdfExportXfdf.xfdf");
117
+ console.log("23. AsposePdfExportXfdf => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
118
+
119
+ //AsposePdfExportXml - Export from a PDF-file with AcroForm to XML
120
+ json = AsposePdfModule.AsposePdfExportXml(pdf_file, resultdir + "ResultPdfExportXml.xml");
121
+ console.log("24. AsposePdfExportXml => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
122
+
123
+ /*Convert to PDF*/
124
+ console.log("Convert to PDF:");
125
+
126
+ //AsposePdfFromTxt - Convert a TXT-file to PDF
127
+ json = AsposePdfModule.AsposePdfFromTxt('./ReadMe.txt', resultdir + "ResultPdfFromTxt.pdf");
128
+ console.log("01. AsposePdfFromTxt => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
129
+
130
+ /*Organize PDF*/
131
+ console.log("Organize PDF:");
132
+
133
+ //AsposePdfOptimize - Optimize a PDF-file
134
+ json = AsposePdfModule.AsposePdfOptimize(pdf_file, resultdir + "ResultOptimize.pdf");
135
+ console.log("01. AsposePdfOptimize => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
136
+
137
+ //AsposePdfMerge2Files - Merge two PDF-files
138
+ json = AsposePdfModule.AsposePdfMerge2Files(pdf_file, pdf_file, resultdir + "ResultMerge.pdf");
139
+ console.log("02. AsposePdfMerge2Files => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
140
+
141
+ //AsposePdfSplit2Files - Split to two PDF-files
142
+ json = AsposePdfModule.AsposePdfSplit2Files(resultdir + "ResultMerge.pdf", 1, resultdir + "ResultSplit1.pdf", resultdir + "ResultSplit2.pdf");
143
+ console.log("03. AsposePdfSplit2Files => %O", json.errorCode == 0 ? [json.fileNameResult1, json.fileNameResult2] : json.errorText);
144
+
145
+ //AsposePdfRotateAllPages - Rotate PDF-pages
146
+ json = AsposePdfModule.AsposePdfRotateAllPages(pdf_file, AsposePdfModule.Rotation.on270, resultdir + "ResultRotation.pdf");
147
+ console.log("04. AsposePdfRotateAllPages => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
148
+
149
+ //AsposePdfDeletePages - Delete pages from a PDF-file
150
+ json = AsposePdfModule.AsposePdfDeletePages(resultdir + "ResultMerge.pdf", resultdir + "ResultDeletePages.pdf", 1);
151
+ console.log("05. AsposePdfDeletePages => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
152
+
153
+ //AsposePdfAddStamp - Add stamp to a PDF-file
154
+ json = AsposePdfModule.AsposePdfAddStamp(pdf_file, aspose_file, 0, 5, 5, 40, 40, AsposePdfModule.Rotation.on270, 0.5, resultdir + "ResultAddStamp.pdf");
155
+ console.log("06. AsposePdfAddStamp => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
156
+
157
+ //AsposePdfAddImage - Add an image to end a PDF-file
158
+ json = AsposePdfModule.AsposePdfAddImage(pdf_file, aspose_file, resultdir + "ResultAddImage.pdf");
159
+ console.log("07. AsposePdfAddImage => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
160
+
161
+ //AsposePdfAddPageNum - Add page number to a PDF-file
162
+ json = AsposePdfModule.AsposePdfAddPageNum(pdf_file, resultdir + "ResultAddPageNum.pdf");
163
+ console.log("08. AsposePdfAddPageNum => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
164
+
165
+ //AsposePdfAddBackgroundImage - Add background image to a PDF-file
166
+ json = AsposePdfModule.AsposePdfAddBackgroundImage(pdf_file, aspose_file, resultdir + "ResultAddBackgroundImage.pdf");
167
+ console.log("09. AsposePdfAddBackgroundImage => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
168
+
169
+ //AsposePdfAddTextHeaderFooter - Add text in Header/Footer of a PDF-file
170
+ json = AsposePdfModule.AsposePdfAddTextHeaderFooter(pdf_file, "Aspose.PDF for Node.js via C++", "ASPOSE", resultdir + "ResultAddHeaderFooter.pdf");
171
+ console.log("10. AsposePdfAddTextHeaderFooter => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
172
+
173
+ //AsposePdfRepair - Repair a PDF-file
174
+ json = AsposePdfModule.AsposePdfRepair(pdf_file, resultdir + "ResultPdfRepair.pdf");
175
+ console.log("11. AsposePdfRepair => %O", json.errorCode == 0 ? JSON.parse(JSON.stringify(json).replace('"errorCode":0,"errorText":"",','')) : json.errorText);
176
+
177
+ //AsposePdfOptimizeResource - Optimize resources of PDF-file
178
+ json = AsposePdfModule.AsposePdfOptimizeResource(pdf_file, resultdir + "ResultPdfOptimizeResource.pdf");
179
+ console.log("12. AsposePdfOptimizeResource => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
180
+
181
+ //AsposePdfSetBackgroundColor - Set the background color for the PDF-file
182
+ json = AsposePdfModule.AsposePdfSetBackgroundColor(pdf_file, "#426bf4", resultdir + "ResultPdfSetBackgroundColor.pdf");
183
+ console.log("13. AsposePdfSetBackgroundColor => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
184
+
185
+ //AsposePdfDeleteAnnotations - Delete annotations from a PDF-file
186
+ json = AsposePdfModule.AsposePdfDeleteAnnotations(pdf_file, resultdir + "ResultPdfDeleteAnnotations.pdf");
187
+ console.log("14. AsposePdfDeleteAnnotations => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
188
+
189
+ //AsposePdfDeleteBookmarks - Delete bookmarks from a PDF-file
190
+ json = AsposePdfModule.AsposePdfDeleteBookmarks(pdf_file, resultdir + "ResultPdfDeleteBookmarks.pdf");
191
+ console.log("15. AsposePdfDeleteBookmarks => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
192
+
193
+ //AsposePdfDeleteAttachments - Delete attachments from a PDF-file
194
+ json = AsposePdfModule.AsposePdfDeleteAttachments(pdf_file, resultdir + "ResultPdfDeleteAttachments.pdf");
195
+ console.log("16. AsposePdfDeleteAttachments => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
196
+
197
+ //AsposePdfDeleteImages - Delete images from a PDF-file
198
+ json = AsposePdfModule.AsposePdfDeleteImages(pdf_file, resultdir + "ResultPdfDeleteImages.pdf");
199
+ console.log("17. AsposePdfDeleteImages => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
200
+
201
+ //AsposePdfDeleteJavaScripts - Delete JavaScripts from a PDF-file
202
+ json = AsposePdfModule.AsposePdfDeleteJavaScripts(pdf_file, resultdir + "ResultPdfDeleteJavaScripts.pdf");
203
+ console.log("18. AsposePdfDeleteJavaScripts => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
204
+
205
+ //AsposePdfAddAttachment - Add attachment to a PDF-file
206
+ json = AsposePdfModule.AsposePdfAddAttachment(pdf_file, './ReadMe.txt', "Description", resultdir + "ResultPdfAddAttachment.pdf");
207
+ console.log("19. AsposePdfAddAttachment => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
208
+
209
+ //AsposePdfGetAttachment - Get attachment from a PDF-file
210
+ json = AsposePdfModule.AsposePdfGetAttachment(resultdir + "ResultPdfAddAttachment.pdf", resultdir + "ResultPdfGetAttachment_{0}");
211
+ console.log("20. AsposePdfGetAttachment => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
212
+
213
+ //AsposePdfReplaceText - Replace text in a PDF-file
214
+ json = AsposePdfModule.AsposePdfReplaceText(pdf_file, "Aspose", "ASPOSE", resultdir + "ResultPdfReplaceText.pdf");
215
+ console.log("21. AsposePdfReplaceText => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
216
+
217
+ //AsposePdfFindText - Find text in a PDF-file
218
+ json = AsposePdfModule.AsposePdfFindText(pdf_file, "Aspose");
219
+ console.log("22. AsposePdfFindText => %O", json.errorCode == 0 ? JSON.parse(JSON.stringify(json).replace('"errorCode":0,"errorText":"",','')) : json.errorText);
220
+
221
+ /*Metadata PDF*/
222
+ console.log("Metadata PDF:");
223
+
224
+ //AsposePdfSetInfo - Set info (metadata) in a PDF-file
225
+ json = AsposePdfModule.AsposePdfSetInfo(pdf_file, "Setting PDF Document Information", "", "Aspose", undefined, "Aspose.Pdf, DOM, API", undefined, "05/05/2023 11:55 PM", resultdir + "ResultSetInfo.pdf");
226
+ console.log("01. AsposePdfSetInfo => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
227
+
228
+ //AsposePdfGetInfo - Get info (metadata) from a PDF-file
229
+ json = AsposePdfModule.AsposePdfGetInfo(resultdir + "ResultSetInfo.pdf");
230
+ console.log("02. AsposePdfGetInfo => %O", json.errorCode == 0 ? JSON.parse(JSON.stringify(json).replace('"errorCode":0,"errorText":"",','')) : json.errorText);
231
+
232
+ //AsposePdfGetAllFonts - Get list fonts from a PDF-file
233
+ json = AsposePdfModule.AsposePdfGetAllFonts(pdf_file);
234
+ console.log("03. AsposePdfGetAllFonts => fonts: %O", json.errorCode == 0 ? json.fonts : json.errorText);
235
+
236
+ //AsposePdfRemoveMetadata - Remove metadata from a PDF-file
237
+ json = AsposePdfModule.AsposePdfRemoveMetadata(pdf_file, resultdir + "ResultPdfRemoveMetadata.pdf");
238
+ console.log("04. AsposePdfRemoveMetadata => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
239
+
240
+ /*Security PDF*/
241
+ console.log("Security PDF:");
242
+
243
+ //AsposePdfEncrypt - Encrypt a PDF-file
244
+ json = AsposePdfModule.AsposePdfEncrypt(pdf_file, "user", "owner", AsposePdfModule.Permissions.PrintDocument, AsposePdfModule.CryptoAlgorithm.RC4x40, resultdir + "ResultEncrypt.pdf");
245
+ console.log("01. AsposePdfEncrypt => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
246
+
247
+ //AsposePdfDecrypt - Decrypt a PDF-file
248
+ json = AsposePdfModule.AsposePdfDecrypt(resultdir + "ResultEncrypt.pdf", "owner", resultdir + "ResultDecrypt.pdf");
249
+ console.log("02. AsposePdfDecrypt => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
250
+
251
+ //AsposePdfSignPKCS7 - Sign a PDF-file with digital signatures
252
+ //Key PKCS7 for test, converted to Base64, with "Pa$$w0rd2023" password
253
+ const test_pfx_file = resultdir +'sign.pfx';
254
+ const test_pfx_data = "MIIEcQIBAzCCBDcGCSqGSIb3DQEHAaCCBCgEggQkMIIEIDCCAj8GCSqGSIb3DQEHBqCCAjAwggIsAgEAMIIC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0Z69x6Gvj/j21gEkGTEDWhmjECjsPCP+sWDMyB1xOxHimJgmLtSHc7hpdE/xuRBVELxhlFI1lYj3fbWbnMNzeLG+OBaoktbpr9kbsWRM568vLxdV7XZYkaoGEd+SEUTR+Yxyak/DHspkO/o4apjOh24U6GCqfqPl4ucxTMvOiYpobrxPub/sqQPXB0NEsqNPjcYdsT1y1YkYMxO0b1heh8TWat6SYk1dLi1wdV0iGf8LTImqzzUobZNBfrybjzElMCMGCSqGSIb3DQEJFTEWBBRBGCVJ5N72ukaNrJUetg4Rp0/41DAxMCEwCQYFKw4DAhoFAAQU8VT/8VxDX7Sx3p05TO3BNne5YXYECJhmeDAQpwBNAgIIAA==";
255
+ fs.writeFileSync(test_pfx_file, test_pfx_data, {encoding: 'base64'});
256
+ //Sign: signatureAppearance
257
+ const sign_png_file = resultdir +'sign.png';
258
+ const sign_png_data = "iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAIAAAAlV+npAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAT6SURBVGhD7ZptTFtVGIBbyqUrbddALRA/gtuYEzs2J5sRBQPZcEUgAwvBDQxOUZP5ScwSl/jDfzPxx4wfi3M4rYNVAkwWZygy4w/RkoyxzVkZg4nMNBaQkVKgdP3At56TI8y2XPWe23MTnx/AfeHXk/c8vTcX+eLioux/+JGAv0uTQDDQ7xzAF/SRtqz9Pa8XWcp6x+z4mjISPoadg6crW2vhB02Suqu2Iz8zD83pIdXN+mV6bO+pfSpd6KFSbVDlKWkxi7BfkpQFqapuq/cpp4vrklO2ObfvSUa+bMM9+C/oIElZkCrH3Ln7diSFDBPh6/QJ5KvcWtPu6PzzT6ggPVmQqiOD76/dGkzJuY5HQPqEqUHJaf27O56i50tigYdUbTlSsNo4ual8AY+WwHn0tiaf38NZzceqjBV4KhxS2iySqnsfWI1Hy/Frpx597NZAKAj7NTJ1FU+FQ0qyXuzavyxVkXBNzMHXuk01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Nlk0BYm8W4vLklSJLqVvhur8wxemadl6WnSw7aVpfjH/NKvGRBSBfrtnwSXwtv/HgjjfQnGXiJgtAvrJS1zKeKkI8ZQHgS5Okvl13G75mmzjLkhIy2R/qB+VUhKQ5zAAAAABJRU5ErkJggg==";
259
+ fs.writeFileSync(sign_png_file, sign_png_data, {encoding: 'base64'});
260
+ //AsposePdfSignPKCS7
261
+ json = AsposePdfModule.AsposePdfSignPKCS7(pdf_file, 1, test_pfx_file, "Pa$$w0rd2023", 100, 100, 200, 100, "Reason", "Contact", "Location", 1, sign_png_file, resultdir + "ResultSignPKCS7.pdf");
262
+ console.log("03. AsposePdfSignPKCS7 => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
263
+ //delete tmp files
264
+ fs.unlinkSync(test_pfx_file);
265
+ fs.unlinkSync(sign_png_file);
266
+
267
+ //AsposePdfChangePassword - Change passwords of the PDF-file
268
+ json = AsposePdfModule.AsposePdfChangePassword(resultdir + "ResultEncrypt.pdf", "owner", "newuser", "newowner", resultdir + "ResultChangePassword.pdf");
269
+ console.log("04. AsposePdfChangePassword => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText);
Binary file
@@ -0,0 +1,8 @@
1
+ The End User License Agreement ("EULA") contains the terms and conditions that
2
+ govern Your use of Aspose's products enclosed or otherwise accompanied herewith
3
+ (individually and collectively, the "PRODUCT") (as linked to below) and imposes
4
+ material limitations on Your License. You should read the EULA carefully. BY
5
+ INSTALLING, DOWNLOADING, COPYING OR OTHERWISE USING THE PRODUCT, YOU AGREE TO BE
6
+ BOUND BY THE TERMS OF THE ASPOSE EULA.
7
+
8
+ You may obtain a copy of the Aspose EULA at: https://about.aspose.com/legal/eula
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "asposepdfnodejs",
3
+ "description": "Aspose.PDF for Node.js via C++",
4
+ "version": "24.2.0",
5
+ "homepage": "https://products.aspose.com/pdf/nodejs-cpp/",
6
+ "readmeFilename": "README.md",
7
+ "main": "./AsposePDFforNode.cjs",
8
+ "module": "./AsposePDFforNode.mjs",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./AsposePDFforNode.mjs",
12
+ "require": "./AsposePDFforNode.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "AsposePDFforNode.cjs",
17
+ "AsposePDFforNode.mjs",
18
+ "AsposePDFforNode.wasm",
19
+ "license/*",
20
+ "LICENSE.md",
21
+ "README.md",
22
+ "ReadMe.pdf",
23
+ "ReadMe.txt",
24
+ "example.cjs",
25
+ "example.mjs",
26
+ "Aspose.jpg"
27
+ ],
28
+ "scripts": {
29
+ "example:cjs": "node ./example.cjs",
30
+ "example:esm": "node ./example.mjs"
31
+ },
32
+ "os": ["!win32"],
33
+ "engines": {
34
+ "node": ">=16.4.0"
35
+ },
36
+ "author": {
37
+ "name": "Aspose.PDF for C++ Team",
38
+ "url": "https://products.aspose.com/pdf/"
39
+ },
40
+ "license": "See Licence in LICENCE.md",
41
+ "keywords": [
42
+ "Aspose",
43
+ "Aspose.PDF",
44
+ "PDF",
45
+ "pdf",
46
+ "EPUB",
47
+ "TEX",
48
+ "SVG",
49
+ "XML",
50
+ "XPS",
51
+ "XLS",
52
+ "XLSX",
53
+ "PPTX",
54
+ "DOC",
55
+ "DOCX",
56
+ "EPUB",
57
+ "SVG",
58
+ "JPEG",
59
+ "PNG",
60
+ "BMP",
61
+ "GIF",
62
+ "TIFF",
63
+ "XML",
64
+ "XPS",
65
+ "Text",
66
+ "FDF",
67
+ "XFDF",
68
+ "PDF-to-DOC",
69
+ "PDF-to-DOCX",
70
+ "PDF-to-PDFA",
71
+ "PDF-to-TIFF",
72
+ "PDF-to-SVG",
73
+ "PDF-to-EPUB",
74
+ "PDF-to-PPTX",
75
+ "PDF-to-TEX",
76
+ "PDF-to-XML",
77
+ "PDF-to-XPS",
78
+ "PDF-to-XLS",
79
+ "PDF-to-XLSX",
80
+ "TXT-to-PDF",
81
+ "PDF-Bookmark",
82
+ "PDF-Attachment",
83
+ "Replace-Text",
84
+ "Extract-Image",
85
+ "Convert-PDF",
86
+ "Convert",
87
+ "Converter",
88
+ "PDF-to-Image",
89
+ "Stamp",
90
+ "Sign",
91
+ "C++",
92
+ "WebAssembly"
93
+ ],
94
+ "dependencies": {
95
+ }
96
+ }