製品を閲覧する

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Product Docs Swagger Examples Blog Support Dashboard

インストール

パッケージは npmjs.com で入手できます。次のコマンドを実行して npm でインストールできます。

npm install groupdocs-viewer-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


要件

依存関係

SDK には次のパッケージが必要です。

PackageConstraint
axios1.8.4
form-data*
jsonwebtoken9.0.1
qs6.11.2

クイックスタート

API 認証情報を取得する

GroupDocs.Viewer Cloud を使用するには、GroupDocs.Cloud Dashboard で登録し、Client ID と Client Secret を取得します。

API を初期化する

GroupDocs.Viewer Cloud SDK for Node.js の使用を開始するには、次のコードを使用します。

"use strict";
const viewer_cloud = require("groupdocs-viewer-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new viewer_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const viewApi = viewer_cloud.ViewApi.fromConfig(config);

完全な例は RunExamples.js を参照してください。

文書を変換してダウンロードする

初期化したら、この基本例を使ってローカル文書をクラウドストレージへアップロードせずに JPG へレンダリングします。

"use strict";
const viewer_cloud = require("groupdocs-viewer-cloud");
const fs = require("fs");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new viewer_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const viewApi = viewer_cloud.ViewApi.fromConfig(config);

(async () => {
    let format = "jpg";
    let filebuf = fs.readFileSync("./Resources/SampleFiles/sample.docx");
    let request = new viewer_cloud.ConvertAndDownloadRequest(format, filebuf);
    let response = await viewApi.convertAndDownload(request);
    console.log("ConvertAndDownload completed: " + response.length);
})();

完全な例は ConvertAndDownload.js を参照してください。

文書をレスポンシブ HTML にレンダリングする

この例はレスポンシブなレイアウトの HTML ビューを作成します。

"use strict";
const viewer_cloud = require("groupdocs-viewer-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new viewer_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const viewApi = viewer_cloud.ViewApi.fromConfig(config);

(async () => {
    let fileInfo = new viewer_cloud.FileInfo();
    fileInfo.filePath = "SampleFiles/sample.docx";
    let viewOptions = new viewer_cloud.ViewOptions();
    viewOptions.fileInfo = fileInfo;
    viewOptions.viewFormat = viewer_cloud.ViewOptions.ViewFormatEnum.HTML;
    viewOptions.renderOptions = new viewer_cloud.HtmlOptions();
    viewOptions.renderOptions.isResponsive = true;

    let request = new viewer_cloud.CreateViewRequest(viewOptions);
    let response = await viewApi.createView(request);
    console.log("HtmlViewerResponsiveLayout completed: " + response.pages.length);
})();

完全な例は HtmlViewerResponsiveLayout.js を参照してください。

選択したページをレンダリングする

この例は文書のページ 2 と 3 を HTML にレンダリングします。

"use strict";
const viewer_cloud = require("groupdocs-viewer-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new viewer_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const viewApi = viewer_cloud.ViewApi.fromConfig(config);

(async () => {
    let fileInfo = new viewer_cloud.FileInfo();
    fileInfo.filePath = "SampleFiles/sample.docx";
    let viewOptions = new viewer_cloud.ViewOptions();
    viewOptions.fileInfo = fileInfo;
    viewOptions.viewFormat = viewer_cloud.ViewOptions.ViewFormatEnum.HTML;
    viewOptions.renderOptions = new viewer_cloud.HtmlOptions();
    viewOptions.renderOptions.pagesToRender = [2, 3];

    let request = new viewer_cloud.CreateViewRequest(viewOptions);
    let response = await viewApi.createView(request);
    console.log("RenderSelectedPages completed: " + response.pages.length);
})();

完全な例は RenderSelectedPages.js を参照してください。

パスワードで保護された文書を表示する

この例はパスワードで保護された Word 文書を HTML にレンダリングします。

"use strict";
const viewer_cloud = require("groupdocs-viewer-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new viewer_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const viewApi = viewer_cloud.ViewApi.fromConfig(config);

(async () => {
    let fileInfo = new viewer_cloud.FileInfo();
    fileInfo.filePath = "SampleFiles/password_protected.docx";
    fileInfo.password = "12345";
    let viewOptions = new viewer_cloud.ViewOptions();
    viewOptions.fileInfo = fileInfo;
    viewOptions.viewFormat = viewer_cloud.ViewOptions.ViewFormatEnum.HTML;

    let request = new viewer_cloud.CreateViewRequest(viewOptions);
    let response = await viewApi.createView(request);
    console.log("ViewProtectedDocument completed: " + response.pages.length);
})();

完全な例は ViewProtectedDocument.js を参照してください。

対応している表示形式を取得する

API がレンダリングできる文書形式を取得します。

"use strict";
const viewer_cloud = require("groupdocs-viewer-cloud");

const clientId = "YourClientId";
const clientSecret = "YourClientSecret";

const config = new viewer_cloud.Configuration(clientId, clientSecret);
config.apiBaseUrl = "https://api.groupdocs.cloud";

const infoApi = viewer_cloud.InfoApi.fromConfig(config);

(async () => {
    let response = await infoApi.getSupportedFileFormats();
    console.log("Formats count: " + response.formats.length);
})();

完全な例は GetSupportedFormats.js を参照してください。

GitHub のサンプル

GroupDocs.Viewer Cloud Node.js Examples リポジトリには、次を扱う実行可能なサンプルが含まれています。

CategoryExamples
Basic Usage変換とダウンロード, HTML ビューアー, 画像ビューアー, PDF ビューアー, 文書情報, 添付ファイル, 対応形式
Rendering Options選択したページ, 連続するページ, 透かし, ノート, コメント, カスタムフォント
Loading Optionsパスワードで保護された文書, エンコーディング
File Typesアーカイブ, CAD, メール, PDF, スプレッドシート, Visio, Word, Outlook, プロジェクトファイル

サンプルの実行方法

  1. サンプルリポジトリ をクローンまたはダウンロードします
  2. Examples/RunExamples.js を編集し、clientId と clientSecret を設定します
  3. Examples ディレクトリに移動します
  4. npm install を実行します
  5. npm update を実行します
  6. npm run-script start を実行します

詳細は Getting Started を参照してください。


Product Docs Swagger Examples Blog Support Dashboard


Tags

Document Rendering API | Node.js Cloud API | GroupDocs.Viewer Cloud | REST API | HTML Rendering | PDF Conversion | Image Rendering | Document Viewing | Multi-Page Rendering | Document Streaming | CAD Rendering | E-Mail Message Rendering | Visio Rendering | MS Project Rendering | Outlook Data Rendering | Spreadsheet Rendering | Word Processing Rendering | Custom View Options | Responsive HTML | Attachment Rendering | Secure API Access | Cloud Storage Integration



 日本