Jelajahi Produk kami

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

Instalasi

Paket tersedia di npmjs.com dan dapat diinstal melalui npm dengan menjalankan perintah berikut:

npm install groupdocs-viewer-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


Persyaratan

Dependensi

SDK memerlukan paket berikut:

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

Mulai cepat

Dapatkan kredensial API Anda

Untuk menggunakan GroupDocs.Viewer Cloud, daftar di GroupDocs.Cloud Dashboard dan dapatkan Client ID dan Client Secret Anda.

Inisialisasi API

Gunakan kode berikut untuk mulai menggunakan 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);

Lihat contoh lengkap di RunExamples.js.

Konversi dan unduh dokumen

Setelah diinisialisasi, gunakan contoh dasar ini untuk merender dokumen lokal ke JPG tanpa mengunggahnya ke penyimpanan cloud.

"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);
})();

Lihat contoh lengkap di ConvertAndDownload.js.

Render dokumen ke HTML responsif

Contoh ini membuat tampilan HTML dengan tata letak responsif.

"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);
})();

Lihat contoh lengkap di HtmlViewerResponsiveLayout.js.

Render halaman terpilih

Contoh ini merender halaman 2 dan 3 dokumen ke 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);
})();

Lihat contoh lengkap di RenderSelectedPages.js.

Lihat dokumen yang dilindungi kata sandi

Contoh ini merender dokumen Word yang dilindungi kata sandi ke 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);
})();

Lihat contoh lengkap di ViewProtectedDocument.js.

Dapatkan format penampil yang didukung

Ambil format dokumen yang dapat dirender oleh 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);
})();

Lihat contoh lengkap di GetSupportedFormats.js.

Contoh di GitHub

Repositori GroupDocs.Viewer Cloud Node.js Examples berisi contoh siap dijalankan yang mencakup:

CategoryExamples
Basic UsageKonversi dan unduh, penampil HTML, penampil gambar, penampil PDF, informasi dokumen, lampiran, format yang didukung
Rendering OptionsHalaman terpilih, halaman berurutan, tanda air, catatan, komentar, font khusus
Loading OptionsDokumen yang dilindungi kata sandi, pengodean
File TypesArsip, CAD, email, PDF, lembar bentang, Visio, Word, Outlook, dan file proyek

Cara menjalankan contoh

  1. Klon atau unduh repositori contoh
  2. Edit Examples/RunExamples.js dan atur clientId serta clientSecret
  3. Buka direktori Examples
  4. Jalankan npm install
  5. Jalankan npm update
  6. Jalankan npm run-script start

Untuk detail selengkapnya, kunjungi 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



 Indonesia