根據我們針對不同平台發布 GroupDocs.Viewer Cloud SDK 的計劃,我們很高興地發布 GroupDocs.Viewer Cloud SDK for Node.js。此 SDK 支持 GroupDocs.Viewer Cloud API 中引入的所有功能。為了方便 Node.js 開發人員,此 SDK 中提供了大量 API 測試用例,以了解 GroupDocs.Viewer Cloud API 的工作及其功能的實現。 GroupDocs.Viewer Cloud 是 REST API,支持多種文檔格式,如 PDF、Words、電子表格、演示文稿、圖像、CAD 等。它允許以 HTML 或圖像形式呈現整個文檔、逐頁或自定義頁面範圍的受支持文檔。它還提供了一些令人興奮的功能,例如水印、文檔轉換(旋轉、重新排序)和字體資源。請點擊此處了解更多詳情。

適用於 Node.js 的 GroupDocs.Viewer Cloud SDK - 簡介

GroupDocs.Viewer Cloud SDK for Node.js 是為其 Node.js 用戶推出的。它是 REST API 的包裝器,允許您在 Node.js 平台中快速輕鬆地使用 GroupDocs.Viewer Cloud REST API,獲得強類型和 IDE 亮點的所有優勢。該發行版可在 GitHub 上獲取。

適用於 Node.js 的 GroupDocs.Viewer Cloud SDK - 示例

GroupDocs.Viewer Cloud SDK for Node.js 示例 還可以指導開發人員熟悉 SDK 及其使用方法,以使用 GroupDocs.Viewer Cloud REST API 調用資源和操作。請參見以下類別的SDK示例。

安裝

您可以安裝 Node.js 模塊來與 GroupDocs.Viewer Cloud API 進行通信。 GroupDocs\Viewer\Cloud 包可在 npmjs.com 上找到。您可以使用以下命令安裝它:

npm install groupdocs-viewer-cloud

數據

為了渲染任何支持的文件,您首先需要將它們上傳到 GroupDocs 雲存儲或第 3 方雲存儲,以使用適用於 Node.js 的 GroupDocs.Viewer Cloud SDK。

入門

在項目中完成包和依賴項的安裝後,您可以輕鬆地在 Node.js 代碼中調用 API 來使用 API 功能。以下示例代碼演示了使用 Node.js SDK 的 GroupDocs.Vewer Cloud API 的工作原理。請按照安裝過程操作,然後運行以下 JavaScript 代碼:

// load the module
var GroupDocs = require('groupdocs-viewer-cloud');

// get your appSid and appKey at https://dashboard.groupdocs.cloud (free registration is required).
var appSid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
var appKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

// construct ViewerApi
var viewerApi = GroupDocs.ViewerApi.fromKeys(appSid, appKey);

// retrieve supported file-formats
viewerApi.getSupportedFileFormats()
    .then(function (response) {
        console.log("Supported file-formats:")
        response.formats.forEach(function (format) {
            console.log(format.fileFormat + " (" + format.extension + ")");
        });
    })
    .catch(function (error) {
        console.log("Error: " + error.message)
    });

GroupDocs.Viewer 雲資源

以下是完成任務可能需要的一些有用資源的鏈接。

立即開始免費試用

立即開始免費試用 – 您只需註冊 GroupDocs 雲服務。註冊後,您就可以嘗試 GroupDocs Cloud 提供的強大文件處理功能。