@groupdocs/groupdocs.viewer 23.8.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.
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head>
3
+ <title>GroupDocs - End User License Agreement (EULA)</title>
4
+ <meta http-equiv="refresh" content="0; url=https://company.groupdocs.com/legal/eula" />
5
+ </head>
6
+ <body>
7
+ <p>Please wait. You'll be redirected to the online version of EULA.</p>
8
+ <p>If it fails to redirect then please go the following link manually: <a href="https://company.groupdocs.com/legal/eula">https://company.groupdocs.com/legal/eula</a></p>
9
+ </body>
10
+ </html>
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ **GroupDocs.Viewer for Node.js via Java** is a high-performance and cross-platform library that allows you to build desktop and web file viewer applications. It supports over 170 document types from popular categories such as Microsoft Office, OpenOffice, AutoCAD, Photoshop, Visio, images, metafiles, programming, archives, messages, PDF & more.
2
+
3
+ ## Node.js Viewer API Features
4
+ - Display document content in any web-browser.
5
+ - View document pages separately.
6
+ - Rotate, reorder pages or add watermarks.
7
+ - Customizable resource management options for CSS, fonts & images.
8
+ - Render all pages of a document as a single PDF.
9
+ - Boost document loading speed with configurable caching.
10
+ - Extract document text along with words' coordinates.
11
+ - Extract basic information about source documents such as file type, pages count and so on.
12
+ - Auto-detect document type.
13
+ - Replace missing font or use custom fonts for rendering.
14
+
15
+ ## Supported File Formats
16
+ View documents in the [most popular file formats](https://docs.groupdocs.com/viewer/nodejs-java/supported-document-formats/) (DOCX, XLSX, PPTX, PDF, DWG, PSD, HTML, ZIP, and more) by rendering them as HTML, PDF, PNG, and JPEG files.
17
+
18
+
19
+ ## Getting Started with GroupDocs.Viewer for Node.js via Java
20
+ ### Installation
21
+
22
+ From the command line:
23
+
24
+ npm install @groupdocs/groupdocs.viewer
25
+
26
+ ### View DOCX As Responsive HTML using Node.js
27
+
28
+ ```js
29
+ const viewer = new groupdocs.viewer.Viewer("sample.docx")
30
+ const viewOptions = groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("output-responsive.html")
31
+ viewOptions.setRenderResponsive(true)
32
+ viewer.view(viewOptions)
33
+ ```
34
+
35
+
36
+ ### View DOCX As Protected PDF via Node.js
37
+
38
+ ```js
39
+ const viewer = new groupdocs.viewer.Viewer("sample.docx");
40
+ const viewOptions = new groupdocs.viewer.PdfViewOptions("output-protect.pdf");
41
+ const permissions = groupdocs.viewer.Permissions;
42
+ const security = new groupdocs.viewer.Security();
43
+
44
+ security.setDocumentOpenPassword("o123");
45
+ security.setPermissionsPassword("p123");
46
+ security.setPermissions(permissions.ALLOW_ALL ^ permissions.DENY_PRINTING);
47
+
48
+ viewOptions.setSecurity(security);
49
+ viewer.view(viewOptions);
50
+ ```
51
+
52
+
53
+ [Home](https://www.groupdocs.com/) | [Product Page](https://products.groupdocs.com/viewer/nodejs-java) | [Documentation](https://docs.groupdocs.com/viewer/nodejs-java/) | [Blog](https://blog.groupdocs.com/category/viewer/) | [API Reference](https://apireference.groupdocs.com/viewer/nodejs-java) | [Code Samples](https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java) | [Free Support](forum.groupdocs.com/c/viewer) | [Temporary License](https://purchase.groupdocs.com/temporary-license)
54
+
package/index.js ADDED
@@ -0,0 +1,25 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ (() => {
5
+ function checkFileExists(filePath) {
6
+ try {
7
+ fs.accessSync(filePath, fs.constants.F_OK);
8
+ return true;
9
+ } catch {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ if (!checkFileExists(path.join(__dirname, 'lib/groupdocs-viewer-nodejs-23.4.jar'))) {
15
+ console.warn('\x1b[33m%s\x1b[0m', `File groupdocs-viewer-nodejs-23.4.jar not found in the lib directory.\nPlease navigate to the package directory:`);
16
+ console.log('\n cd node_modules/@groupdocs/groupdocs.viewer\n')
17
+ console.warn('\x1b[33m%s\x1b[0m', `Then download the JAR file using the command:`);
18
+ console.log('\n npm run postinstall\n');
19
+ process.exit(0)
20
+ }
21
+ else {
22
+ module.exports = require('./lib/groupdocs.viewer')
23
+ }
24
+ })()
25
+
@@ -0,0 +1,161 @@
1
+ const path = require('path')
2
+ const java = require('java')
3
+ const os = require('os')
4
+
5
+ if (os.platform() === 'darwin') {
6
+ java.options.push('-Djava.awt.headless=true')
7
+ }
8
+
9
+ java.asyncOptions = {
10
+ asyncSuffix: 'Async',
11
+ syncSuffix: '',
12
+ }
13
+
14
+ java.classpath.push(path.join(__dirname, '/groupdocs-viewer-nodejs-23.4.jar'))
15
+
16
+ exports = module.exports
17
+
18
+ function __typeof__(objClass) {
19
+ if (objClass !== undefined && objClass.constructor) {
20
+ const strFun = objClass.constructor.toString()
21
+ let className = strFun.substr(0, strFun.indexOf('('))
22
+ className = className.replace('function', '')
23
+ return className.replace(/(^\s*)|(\s*$)/gi, '')
24
+ }
25
+ return typeof objClass
26
+ }
27
+
28
+ /** STREAM HELPERS * */
29
+ exports.readDataFromStream = function (readStream, callback) {
30
+ const inputStreamBuffer = new exports.StreamBuffer()
31
+ readStream.on('data', chunk => {
32
+ inputStreamBuffer.write(chunk)
33
+ })
34
+ readStream.on('end', () => {
35
+ callback(inputStreamBuffer.toInputStream())
36
+ })
37
+ }
38
+
39
+ exports.readBytesFromStream = function (readStream, callback) {
40
+ const inputStreamBuffer = new exports.StreamBuffer()
41
+ readStream.on('data', chunk => {
42
+ inputStreamBuffer.write(chunk)
43
+ })
44
+ readStream.on('end', () => {
45
+ const array = Array.from(inputStreamBuffer.toByteArray())
46
+ const javaArray = java.newArray('byte', array)
47
+ callback(javaArray)
48
+ })
49
+ }
50
+
51
+
52
+ exports.License = java.import("com.groupdocs.viewer.License");
53
+ exports.Metered = java.import("com.groupdocs.viewer.Metered");
54
+ exports.Viewer = java.import("com.groupdocs.viewer.Viewer");
55
+ exports.ViewerSettings = java.import("com.groupdocs.viewer.ViewerSettings");
56
+ exports.FileCache = java.import("com.groupdocs.viewer.caching.FileCache");
57
+ exports.CacheableFactory = java.import("com.groupdocs.viewer.caching.extra.CacheableFactory");
58
+ exports.DocumentSavingArgs = java.import("com.groupdocs.viewer.domain.documents.converting.tohtml.utils.DocumentSavingArgs");
59
+ exports.ArchiveSecurityException = java.import("com.groupdocs.viewer.exception.ArchiveSecurityException");
60
+ exports.FileNotFoundException = java.import("com.groupdocs.viewer.exception.FileNotFoundException");
61
+ exports.GroupDocsException = java.import("com.groupdocs.viewer.exception.GroupDocsException");
62
+ exports.GroupDocsViewerException = java.import("com.groupdocs.viewer.exception.GroupDocsViewerException");
63
+ exports.IncorrectPasswordException = java.import("com.groupdocs.viewer.exception.IncorrectPasswordException");
64
+ exports.LicenseException = java.import("com.groupdocs.viewer.exception.LicenseException");
65
+ exports.NotSupportedException = java.import("com.groupdocs.viewer.exception.NotSupportedException");
66
+ exports.PasswordRequiredException = java.import("com.groupdocs.viewer.exception.PasswordRequiredException");
67
+ exports.FolderFontSource = java.import("com.groupdocs.viewer.fonts.FolderFontSource");
68
+ exports.FontSettings = java.import("com.groupdocs.viewer.fonts.FontSettings");
69
+ exports.ConsoleLogger = java.import("com.groupdocs.viewer.logging.ConsoleLogger");
70
+ exports.FileLogger = java.import("com.groupdocs.viewer.logging.FileLogger");
71
+ exports.ViewerLogger = java.import("com.groupdocs.viewer.logging.ViewerLogger");
72
+ exports.ArchiveOptions = java.import("com.groupdocs.viewer.options.ArchiveOptions");
73
+ exports.ArchiveSecurityOptions = java.import("com.groupdocs.viewer.options.ArchiveSecurityOptions");
74
+ exports.EmailOptions = java.import("com.groupdocs.viewer.options.EmailOptions");
75
+ exports.FileName = java.import("com.groupdocs.viewer.options.FileName");
76
+ exports.JpgViewOptions = java.import("com.groupdocs.viewer.options.JpgViewOptions");
77
+ exports.LoadOptions = java.import("com.groupdocs.viewer.options.LoadOptions");
78
+ exports.MailStorageOptions = java.import("com.groupdocs.viewer.options.MailStorageOptions");
79
+ exports.OutlookOptions = java.import("com.groupdocs.viewer.options.OutlookOptions");
80
+ exports.PdfOptions = java.import("com.groupdocs.viewer.options.PdfOptions");
81
+ exports.PdfViewOptions = java.import("com.groupdocs.viewer.options.PdfViewOptions");
82
+ exports.Permissions = java.import("com.groupdocs.viewer.options.Permissions");
83
+ exports.PngViewOptions = java.import("com.groupdocs.viewer.options.PngViewOptions");
84
+ exports.PresentationOptions = java.import("com.groupdocs.viewer.options.PresentationOptions");
85
+ exports.ProjectManagementOptions = java.import("com.groupdocs.viewer.options.ProjectManagementOptions");
86
+ exports.Security = java.import("com.groupdocs.viewer.options.Security");
87
+ exports.Size = java.import("com.groupdocs.viewer.options.Size");
88
+ exports.TextOptions = java.import("com.groupdocs.viewer.options.TextOptions");
89
+ exports.Tile = java.import("com.groupdocs.viewer.options.Tile");
90
+ exports.VisioRenderingOptions = java.import("com.groupdocs.viewer.options.VisioRenderingOptions");
91
+ exports.Watermark = java.import("com.groupdocs.viewer.options.Watermark");
92
+ exports.WordProcessingOptions = java.import("com.groupdocs.viewer.options.WordProcessingOptions");
93
+ exports.ArchiveViewInfoImpl = java.import("com.groupdocs.viewer.results.ArchiveViewInfoImpl");
94
+ exports.AttachmentImpl = java.import("com.groupdocs.viewer.results.AttachmentImpl");
95
+ exports.CadViewInfoImpl = java.import("com.groupdocs.viewer.results.CadViewInfoImpl");
96
+ exports.CharacterImpl = java.import("com.groupdocs.viewer.results.CharacterImpl");
97
+ exports.FileInfoImpl = java.import("com.groupdocs.viewer.results.FileInfoImpl");
98
+ exports.LayerImpl = java.import("com.groupdocs.viewer.results.LayerImpl");
99
+ exports.LayoutImpl = java.import("com.groupdocs.viewer.results.LayoutImpl");
100
+ exports.LineImpl = java.import("com.groupdocs.viewer.results.LineImpl");
101
+ exports.LotusNotesViewInfoImpl = java.import("com.groupdocs.viewer.results.LotusNotesViewInfoImpl");
102
+ exports.MboxViewInfoImpl = java.import("com.groupdocs.viewer.results.MboxViewInfoImpl");
103
+ exports.OutlookViewInfoImpl = java.import("com.groupdocs.viewer.results.OutlookViewInfoImpl");
104
+ exports.PageImpl = java.import("com.groupdocs.viewer.results.PageImpl");
105
+ exports.PdfViewInfoImpl = java.import("com.groupdocs.viewer.results.PdfViewInfoImpl");
106
+ exports.ProjectManagementViewInfoImpl = java.import("com.groupdocs.viewer.results.ProjectManagementViewInfoImpl");
107
+ exports.Resource = java.import("com.groupdocs.viewer.results.Resource");
108
+ exports.TextElementImpl = java.import("com.groupdocs.viewer.results.TextElementImpl");
109
+ exports.ViewInfoImpl = java.import("com.groupdocs.viewer.results.ViewInfoImpl");
110
+ exports.WordImpl = java.import("com.groupdocs.viewer.results.WordImpl");
111
+ exports.MemoryCleaner = java.import("com.groupdocs.viewer.utils.MemoryCleaner");
112
+ exports.StreamBuffer = java.import("com.groupdocs.viewer.utils.StreamBuffer");
113
+
114
+ exports.FileType = java.import("com.groupdocs.viewer.FileType");
115
+ exports.CacheKeys = java.import("com.groupdocs.viewer.caching.CacheKeys");
116
+ exports.SearchOption = java.import("com.groupdocs.viewer.fonts.SearchOption");
117
+ exports.CadOptions = java.import("com.groupdocs.viewer.options.CadOptions");
118
+ exports.Field = java.import("com.groupdocs.viewer.options.Field");
119
+ exports.HtmlViewOptions = java.import("com.groupdocs.viewer.options.HtmlViewOptions");
120
+ exports.ImageQuality = java.import("com.groupdocs.viewer.options.ImageQuality");
121
+ exports.PageSize = java.import("com.groupdocs.viewer.options.PageSize");
122
+ exports.Position = java.import("com.groupdocs.viewer.options.Position");
123
+ exports.Resolution = java.import("com.groupdocs.viewer.options.Resolution");
124
+ exports.Rotation = java.import("com.groupdocs.viewer.options.Rotation");
125
+ exports.SpreadsheetOptions = java.import("com.groupdocs.viewer.options.SpreadsheetOptions");
126
+ exports.TextOverflowMode = java.import("com.groupdocs.viewer.options.TextOverflowMode");
127
+ exports.TimeUnit = java.import("com.groupdocs.viewer.options.TimeUnit");
128
+ exports.ViewInfoOptions = java.import("com.groupdocs.viewer.options.ViewInfoOptions");
129
+ exports.PathUtils = java.import("com.groupdocs.viewer.utils.PathUtils");
130
+
131
+
132
+ exports.StreamBuffer = class StreamBuffer {
133
+ constructor() {
134
+ const self = java.newInstanceSync('com.groupdocs.viewer.utils.StreamBuffer')
135
+
136
+ self.write = function (chunk) {
137
+ const array = Array.from(chunk)
138
+ const javaArray = java.newArray('byte', array)
139
+ self.__proto__.write.call(self, javaArray, 0, javaArray.length)
140
+ }
141
+ return self
142
+ }
143
+ }
144
+
145
+ /** STREAM METHODS * */
146
+
147
+ exports.License.setLicenseFromStream = function (license, licenseStream, callback) {
148
+ const inputStreamBuffer = new exports.StreamBuffer()
149
+ licenseStream.on('data', chunk => {
150
+ inputStreamBuffer.write(chunk)
151
+ })
152
+ licenseStream.on('end', () => {
153
+ let error
154
+ try {
155
+ license.setLicense(inputStreamBuffer.toInputStream())
156
+ } catch (err) {
157
+ error = err
158
+ }
159
+ callback(error)
160
+ })
161
+ }
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@groupdocs/groupdocs.viewer",
3
+ "version": "23.8.0",
4
+ "description": "Powerful, high-performance and cross-platform library that allows you to build desktop and web file viewer applications.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "curl -H 'Cache-Control:no-cache' https://releases.groupdocs.com/java/repo/com/groupdocs/groupdocs-viewer-nodejs/23.4/groupdocs-viewer-nodejs-23.4.jar > lib/groupdocs-viewer-nodejs-23.4.jar"
8
+ },
9
+ "keywords": [
10
+ "view",
11
+ "viewer",
12
+ "PDF",
13
+ "Word",
14
+ "DOCX",
15
+ "DOC",
16
+ "PowerPoint",
17
+ "PPT",
18
+ "PPTX",
19
+ "Excel",
20
+ "XLS",
21
+ "XLSX",
22
+ "CSV",
23
+ "to",
24
+ "JPG",
25
+ "PNG",
26
+ "Spreadsheet",
27
+ "SVG"
28
+ ],
29
+ "author": "Aspose",
30
+ "license": "End User License Agreement.html",
31
+ "dependencies": {
32
+ "java": "^0.13.0"
33
+ },
34
+ "directories": {
35
+ "lib": "lib"
36
+ }
37
+ }