Explore nuestros productos

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

Instalación

El paquete está disponible en npmjs.com y se puede instalar mediante npm ejecutando el siguiente comando:

npm install groupdocs-viewer-cloud

NPM Version NPM Downloads NPM-GroupDocsCloud


Requisitos

Dependencias

El SDK requiere los siguientes paquetes:

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

Inicio rápido

Obtenga sus credenciales de API

Para usar GroupDocs.Viewer Cloud, regístrese en el GroupDocs.Cloud Dashboard y obtenga su Client ID y Client Secret.

Inicialice la API

Utilice el siguiente código para empezar a usar el 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);

Vea el ejemplo completo en RunExamples.js.

Convierta y descargue un documento

Una vez inicializado, use este ejemplo básico para representar un documento local como JPG sin cargarlo en el almacenamiento en la nube.

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

Vea el ejemplo completo en ConvertAndDownload.js.

Represente un documento como HTML adaptable

Este ejemplo crea una vista HTML con un diseño adaptable.

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

Vea el ejemplo completo en HtmlViewerResponsiveLayout.js.

Represente páginas seleccionadas

Este ejemplo representa las páginas 2 y 3 de un documento como 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);
})();

Vea el ejemplo completo en RenderSelectedPages.js.

Vea un documento protegido con contraseña

Este ejemplo representa un documento de Word protegido con contraseña como 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);
})();

Vea el ejemplo completo en ViewProtectedDocument.js.

Obtenga los formatos de Viewer compatibles

Recupere los formatos de documento que la API puede representar.

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

Vea el ejemplo completo en GetSupportedFormats.js.

Ejemplos en GitHub

El repositorio GroupDocs.Viewer Cloud Node.js Examples incluye ejemplos listos para ejecutar que cubren:

CategoryExamples
Basic UsageConvertir y descargar, visor HTML, visor de imágenes, visor PDF, información del documento, datos adjuntos, formatos compatibles
Rendering OptionsPáginas seleccionadas, páginas consecutivas, marcas de agua, notas, comentarios, fuentes personalizadas
Loading OptionsDocumentos protegidos con contraseña, codificación
File TypesArchivo, CAD, correo electrónico, PDF, hoja de cálculo, Visio, Word, Outlook y archivos de proyecto

Cómo ejecutar los ejemplos

  1. Clone o descargue el repositorio de ejemplos
  2. Edite Examples/RunExamples.js y establezca clientId y clientSecret
  3. Vaya al directorio Examples
  4. Ejecute npm install
  5. Ejecute npm update
  6. Ejecute npm run-script start

Para obtener más detalles, visite 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



 Español