From 2755300387fb3b75f1816236e8be4894375aa509 Mon Sep 17 00:00:00 2001 From: Yevgen Nykytenko Date: Thu, 7 Sep 2023 15:10:32 +0300 Subject: [PATCH] Initial documentation for Node.js product --- .github/workflows/publish-prod.yml | 1 + .github/workflows/publish-qa.yml | 1 + build_docs.cmd | 1 + .../rendering-basics/render-word-documents.md | 2 +- nodejs-java/_index.md | 97 +++++ nodejs-java/developer-guide/_index.md | 11 + .../developer-guide/caching-results/_index.md | 50 +++ .../_index.md | 10 + .../processing-attachments/_index.md | 19 + .../how-to-extract-and-save-attachments.md | 34 ++ .../rendering-documents/_index.md | 23 ++ .../rendering-documents/add-text-watermark.md | 32 ++ .../rendering-to-html/_index.md | 58 +++ .../rendering-to-pdf/_index.md | 31 ++ .../retrieving-document-information/_index.md | 19 + .../how-to-get-file-type-and-pages-count.md | 42 +++ nodejs-java/getting-started/_index.md | 10 + .../getting-started/features-overview.md | 98 ++++++ .../getting-started/how-to-run-examples.md | 32 ++ nodejs-java/getting-started/installation.md | 21 ++ .../licensing-and-subscription.md | 98 ++++++ .../supported-document-formats.md | 296 ++++++++++++++++ .../getting-started/system-requirements.md | 54 +++ nodejs-java/product-overview.md | 50 +++ nodejs-java/rendering-basics/_index.md | 10 + nodejs-java/rendering-basics/render-images.md | 209 +++++++++++ .../rendering-basics/render-pdf-documents.md | 330 ++++++++++++++++++ .../rendering-basics/render-presentations.md | 235 +++++++++++++ .../render-spreadsheets/_index.md | 10 + ...er-excel-and-apple-numbers-spreadsheets.md | 329 +++++++++++++++++ .../rendering-basics/render-text-files.md | 248 +++++++++++++ .../rendering-basics/render-web-documents.md | 138 ++++++++ .../rendering-basics/render-word-documents.md | 225 ++++++++++++ nodejs-java/technical-support.md | 40 +++ 34 files changed, 2863 insertions(+), 1 deletion(-) create mode 100644 nodejs-java/_index.md create mode 100644 nodejs-java/developer-guide/_index.md create mode 100644 nodejs-java/developer-guide/caching-results/_index.md create mode 100644 nodejs-java/developer-guide/loading-documents/loading-documents-from-different-sources/_index.md create mode 100644 nodejs-java/developer-guide/processing-attachments/_index.md create mode 100644 nodejs-java/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md create mode 100644 nodejs-java/developer-guide/rendering-documents/_index.md create mode 100644 nodejs-java/developer-guide/rendering-documents/add-text-watermark.md create mode 100644 nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md create mode 100644 nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md create mode 100644 nodejs-java/developer-guide/retrieving-document-information/_index.md create mode 100644 nodejs-java/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md create mode 100644 nodejs-java/getting-started/_index.md create mode 100644 nodejs-java/getting-started/features-overview.md create mode 100644 nodejs-java/getting-started/how-to-run-examples.md create mode 100644 nodejs-java/getting-started/installation.md create mode 100644 nodejs-java/getting-started/licensing-and-subscription.md create mode 100644 nodejs-java/getting-started/supported-document-formats.md create mode 100644 nodejs-java/getting-started/system-requirements.md create mode 100644 nodejs-java/product-overview.md create mode 100644 nodejs-java/rendering-basics/_index.md create mode 100644 nodejs-java/rendering-basics/render-images.md create mode 100644 nodejs-java/rendering-basics/render-pdf-documents.md create mode 100644 nodejs-java/rendering-basics/render-presentations.md create mode 100644 nodejs-java/rendering-basics/render-spreadsheets/_index.md create mode 100644 nodejs-java/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md create mode 100644 nodejs-java/rendering-basics/render-text-files.md create mode 100644 nodejs-java/rendering-basics/render-web-documents.md create mode 100644 nodejs-java/rendering-basics/render-word-documents.md create mode 100644 nodejs-java/technical-support.md diff --git a/.github/workflows/publish-prod.yml b/.github/workflows/publish-prod.yml index b9017dd..0233b7a 100644 --- a/.github/workflows/publish-prod.yml +++ b/.github/workflows/publish-prod.yml @@ -36,6 +36,7 @@ jobs: mkdir -p common/content/${{ env.PRODUCT }} cp -r java common/content/${{ env.PRODUCT }} cp -r net common/content/${{ env.PRODUCT }} + cp -r nodejs-java common/content/${{ env.PRODUCT }} cp _index.md common/content/${{ env.PRODUCT }} hugo --source common --minify --config config-geekdoc.toml,ignore-total-config.toml,show-feedback-config.toml diff --git a/.github/workflows/publish-qa.yml b/.github/workflows/publish-qa.yml index 6427296..dac21ac 100644 --- a/.github/workflows/publish-qa.yml +++ b/.github/workflows/publish-qa.yml @@ -30,6 +30,7 @@ jobs: mkdir -p common/content/${{ env.PRODUCT }} cp -r java common/content/${{ env.PRODUCT }} cp -r net common/content/${{ env.PRODUCT }} + cp -r nodejs-java common/content/${{ env.PRODUCT }} cp _index.md common/content/${{ env.PRODUCT }} hugo --source common --minify --config config-geekdoc.toml,ignore-total-config.toml,show-feedback-config.toml --baseURL 'https://docs-qa.groupdocs.com/' diff --git a/build_docs.cmd b/build_docs.cmd index d80a117..d48b27c 100644 --- a/build_docs.cmd +++ b/build_docs.cmd @@ -4,6 +4,7 @@ call git submodule update --init --recursive call git submodule foreach git pull origin master xcopy java common\content\%PRODUCT%\java /s /e /Y /i xcopy net common\content\%PRODUCT%\net /s /e /Y /i +xcopy nodejs-java common\content\%PRODUCT%\nodejs-java /s /e /Y /i xcopy _index.md common\content\%PRODUCT% cd common call hugo server --config config-geekdoc.toml,ignore-total-config.toml,show-feedback-config.toml diff --git a/java/rendering-basics/render-word-documents.md b/java/rendering-basics/render-word-documents.md index 7a4a111..9af610f 100644 --- a/java/rendering-basics/render-word-documents.md +++ b/java/rendering-basics/render-word-documents.md @@ -258,7 +258,7 @@ import com.groupdocs.viewer.options.PdfViewOptions; try (Viewer viewer = new Viewer("resume.docx")) { // Convert the document to PDF. PdfViewOptions viewOptions = new PdfViewOptions("output.pdf"); - // Enable tracked changes rendering. + // Enable rendering comments. viewOptions.setRenderComments(true); viewer.view(viewOptions); } diff --git a/nodejs-java/_index.md b/nodejs-java/_index.md new file mode 100644 index 0000000..42f5965 --- /dev/null +++ b/nodejs-java/_index.md @@ -0,0 +1,97 @@ +--- +id: home +url: viewer/nodejs-java +title: GroupDocs.Viewer for Node.js via Java +linkTitle: GroupDocs.Viewer for Node.js +weight: 1 +description: "GroupDocs.Viewer for Node.js allows you to render documents in various formats as HTML, PDF, JPEG, and PNG files. You do not need to use third-party software to view files within your JavaScript application." +keywords: render files, view files, HTML, PDF, JPEG, PNG +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: True +fullWidth: True +--- +groupdocs-viewer-java-home + +
+ + Latest version 23.8.0 (August 2023) + +
+ +{{< button style="primary" link="https://releases.groupdocs.com/viewer/nodejs-java/release-notes/" >}} Release notes {{< /button >}} +{{< button style="primary" link="https://www.npmjs.com/package/@groupdocs/groupdocs.viewer/" >}} {{< icon "gdoc_download" >}} Package repository {{< /button >}} + +GroupDocs.Viewer for Node.js is a powerful, high-performance, and cross-platform library that allows you to build desktop and web [file viewer applications](https://en.wikipedia.org/wiki/File_viewer). + +GroupDocs.Viewer supports over [170 popular file formats](/viewer/nodejs-java/supported-document-formats). Load text documents, spreadsheets, presentations, PDF files, web pages, email messages, and images and render/display them in HTML, PDF, PNG, and JPEG formats. You can render the entire document or specific pages. + +GroupDocs.Viewer ships with a wide range of options that allow you to control the rendering process and customize the output files. For example, you can protect the output PDF file and reorder its pages, generate responsive HTML pages, adjust the size and quality of output images, add text watermarks, and cache the results. + +------ + +{{< columns >}} +

About GroupDocs.Viewer

+

OVERVIEW

+ + +

GET STARTED

+ + +<---> + +

Developer Guide

+

RENDERING BASICS

+ + +

HOW-TO GUIDES

+ + +

API REFERENCE

+ + +<---> + +

Useful Resources

+

DEMOS AND EXAMPLES

+ + +

VERSION HISTORY

+ + +

TECHNICAL SUPPORT

+ + +{{< /columns >}} diff --git a/nodejs-java/developer-guide/_index.md b/nodejs-java/developer-guide/_index.md new file mode 100644 index 0000000..81388a6 --- /dev/null +++ b/nodejs-java/developer-guide/_index.md @@ -0,0 +1,11 @@ +--- +id: developer-guide +url: viewer/nodejs-java/developer-guide +title: Developer Guide +weight: 4 +description: "Explains GroupDocs.Viewer for Node.js file viewer features and shows how to view PDF, Word, Excel, PowerPoint documents inside your JavaScript applications" +keywords: GroupDocs.Viewer Developer Guide, GroupDocs.Viewer Java Developer Guide, GroupDocs.Viewer Developer Guide Java, Using GroupDocs.Viewer for Node.js, GroupDocs.Viewer for Node.js use cases +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +isMenuItemWithNoContent: True +--- diff --git a/nodejs-java/developer-guide/caching-results/_index.md b/nodejs-java/developer-guide/caching-results/_index.md new file mode 100644 index 0000000..f544a31 --- /dev/null +++ b/nodejs-java/developer-guide/caching-results/_index.md @@ -0,0 +1,50 @@ +--- +id: caching-results +url: viewer/nodejs-java/caching-results +title: Cache results +weight: 5 +keywords: caching,caching results,groupdocs.viewer +description: "This article contains caching use-cases with GroupDocs.Viewer within your JavaScript applications." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- +Caching saves rendering results to a specified location, such as a local disk. When you re-request the rendering results, GroupDocs.Viewer does not render again, but uses the cached results. +As a document can take a long time to render, use caching if you expect to reuse the rendering results. + +To enable caching, follow these steps: + +1. Instantiate the desired cache object (for example, [FileCache](#) to store document rendering results at the local drive) +2. Instantiate the [ViewerSettings](#) object. Specify the cache object as a parameter of the constructor. +3. Instantiate the [Viewer](#) object. Specify the [ViewerSettings](#) object as a parameter of the constructor. +4. Call the [view()](#) method of the [Viewer](#) class. + +The following code snippet shows how to enable caching and displays the difference between rendering a file and getting the cached results: + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const cachePath = "cache"; +const cache = new FileCache(cachePath); +const settings = new ViewerSettings(cache); + +const viewer = new groupdocs.viewer.Viewer("sample.docx", settings) +const options = HtmlViewOptions.forEmbeddedResources(); +const currentTimeMillis = Date.now() + +viewer.view(options); +currentTimeMillis = Date.now() - currentTimeMillis +console.log("Time taken on first call to View method " + currentTimeMillis + " (ms).") +currentTimeMillis = Date.now() + +viewer.view(options) +currentTimeMillis = Date.now() - currentTimeMillis +console.log("Time taken on second call to View method " + currentTimeMillis + " (ms).") +``` +{{< /tab >}} +{{< /tabs >}} + +The following image shows a sample console output: + +![](/viewer/java/images/caching-results.png) + +For details, please refer to the following pages: \ No newline at end of file diff --git a/nodejs-java/developer-guide/loading-documents/loading-documents-from-different-sources/_index.md b/nodejs-java/developer-guide/loading-documents/loading-documents-from-different-sources/_index.md new file mode 100644 index 0000000..923a30f --- /dev/null +++ b/nodejs-java/developer-guide/loading-documents/loading-documents-from-different-sources/_index.md @@ -0,0 +1,10 @@ +--- +id: loading-documents-from-different-sources +url: viewer/nodejs-java/loading-documents-from-different-sources +title: Load documents from different sources +weight: 1 +description: "This article contains document loading use-cases with GroupDocs.Viewer within your JavaScript applications." +keywords: +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- diff --git a/nodejs-java/developer-guide/processing-attachments/_index.md b/nodejs-java/developer-guide/processing-attachments/_index.md new file mode 100644 index 0000000..f4f91ee --- /dev/null +++ b/nodejs-java/developer-guide/processing-attachments/_index.md @@ -0,0 +1,19 @@ +--- +id: working-with-attachments +url: viewer/nodejs-java/working-with-attachments +title: Process attachments +weight: 4 +description: "Processing email attachments, embedded files, and compressed files with GroupDocs.Viewer for JavaScript" +keywords: email attachments, embedded files, compressed files +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- + +Using GroupDocs.Viewer, you can list and save the following attachments: + +* Email attachments +* Files embedded in PDF files +* Email messages contained by Outlook, LotusNotes and other storage files +* Compressed files + +See following examples on how to process document attachments in more details: diff --git a/nodejs-java/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md b/nodejs-java/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md new file mode 100644 index 0000000..482cf0a --- /dev/null +++ b/nodejs-java/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md @@ -0,0 +1,34 @@ +--- +id: how-to-extract-and-save-attachments +url: viewer/nodejs-java/how-to-extract-and-save-attachments +title: Save attachments +weight: 2 +description: "Save attachments and embedded files from PDF, Outlook data file or email" +keywords: Save attachments, embedded files from PDF, Outlook data file +productName: GroupDocs.Viewer for Java +hideChildren: False +--- +To get and save attachments, follow these steps: + +1. Instantiate the [Viewer](#) object. Specify a file that contains attachments. +2. Call the [getAttachments](#) method. It returns the attachment collection. +3. Iterate through the collection. To save an attachment, call the [saveAttachment](#) method. + +The following code snippet shows how to get and save all attachments from the MSG file: + +{{< alert style="info" >}}NOTE: provided code snippet suits all format families that support attachments: emails, Outlook data files, archives, and PDF documents.{{< /alert >}} + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("with_attachments.msg") +const attachments = viewer.getAttachments(); +console.log('Attachments:\n'); + +for(let i = 0; i < attachments.size(); i++ ){ + console.log(attachments.get(i).toString()); +} +console.log('\nAttachments retrieved successfully.'); +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/nodejs-java/developer-guide/rendering-documents/_index.md b/nodejs-java/developer-guide/rendering-documents/_index.md new file mode 100644 index 0000000..9896100 --- /dev/null +++ b/nodejs-java/developer-guide/rendering-documents/_index.md @@ -0,0 +1,23 @@ +--- +id: rendering-documents +url: viewer/nodejs-java/rendering-documents +title: Render documents +weight: 3 +description: "Rendering documents with GroupDocs.Viewer for Node.js in your Java applications." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- +In GroupDocs.Viewer, rendering is the process of converting a document into one or more files suitable to display. The resulting files can be in one of the following formats: + +* HTML +* PDF +* Images (JPG or PNG) + +If the source document contains several pages, the result of rendering to PDF is one paginated file. +Rendering a multi-page document to HTML or images results in multiple files, one for each page. + +For example, if you have a .docx file with three pages, converting that file to HTML/images results in three HTML or image files that represent the pages in the document. Converting this file to PDF results in one file with three pages + +![Rendering diagram](/viewer/java/images/getting-started/features-overview/rendering.png) + +For details, please refer to the following pages: \ No newline at end of file diff --git a/nodejs-java/developer-guide/rendering-documents/add-text-watermark.md b/nodejs-java/developer-guide/rendering-documents/add-text-watermark.md new file mode 100644 index 0000000..faf6835 --- /dev/null +++ b/nodejs-java/developer-guide/rendering-documents/add-text-watermark.md @@ -0,0 +1,32 @@ +--- +id: add-text-watermark +url: viewer/nodejs-java/add-text-watermark +title: Add text watermarks +weight: 9 +description: "This article explains how to add text watermark when rendering documents with GroupDocs.Viewer within your JavaScript applications." +keywords: add text watermark, rendering documents +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- +To add a watermark to the HTML/JPG/PNG/PDF output, follow these steps: + +1. Create an instance of the [HtmlViewOptions](#) class (or [PngViewOptions](#), or [JpgViewOptions](#), or [PdfViewOptions](#)); +2. Create a [Watermark](#) object and populate its properties; +3. Call the [setWatermark](#) method of the [HtmlViewOptions](#) (or [PngViewOptions](#), or [JpgViewOptions](#), or [PdfViewOptions](#)) class and specify the object created on step 2; +4. Call the [Viewer.view()](#) method. + +The following code snippet shows how to apply the watermark to the output pages. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.docx") +// Create an HTML file. +const viewOptions = groupdocs.viewer.HtmlViewOptions.forEmbeddedResources(output-watermark.html) +// Add watermark. +const watermark = new groupdocs.viewer.Watermark('This is a watermark') +viewOptions.setWatermark(watermark); +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} \ No newline at end of file diff --git a/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md b/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md new file mode 100644 index 0000000..18e2e05 --- /dev/null +++ b/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md @@ -0,0 +1,58 @@ +--- +id: rendering-to-html +url: viewer/nodejs-java/rendering-to-html +title: Render to HTML +weight: 11 +description: "With GroupDocs.Viewer for Node.js you can render files to HTML format. As a simple usecase please see how easily you can convert Microsoft Word to clean html." +keywords: render files, rendering pdf, convert word to clean html +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- +When rendering to HTML, GroupDocs.Viewer renders each page of the source document as a separate HTML document. + +GroupDocs.Viewer for Node.js provides two options to manage CSS, fonts, images, and other resources: + +1. HTML with external resources stores page resources as separate files. This allows reusing common resources and results in reducing page size and loading speed. +2. HTML with embedded resources integrates page resources into HTML. This makes each document page self-sufficient but results in increasing page size and loading speed. + +To render files to HTML, follow these steps: + +1. Create an instance of the [Viewer](#) class. Specify the source document path as a constructor parameter. +2. Instantiate the [HtmlViewOptions](#) object. Specify a path to save the rendered pages. +3. Call the [View.view()](#) method of the [Viewer](#) object. Specify the [HtmlViewOptions](#) object as the parameter. + +## Rendering to HTML with external resources + +The following code snippet shows how to render a .docx document to HTML with external resources: + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.docx") +// Create an HTML file for each page. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Rendering to HTML with embedded resources + +The following code snippet shows how to render a .docx document to HTML with embedded resources: + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.docx") +// Create an HTML files. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +For details, please refer to the following pages: diff --git a/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md b/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md new file mode 100644 index 0000000..4ebe438 --- /dev/null +++ b/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md @@ -0,0 +1,31 @@ +--- +id: rendering-to-pdf +url: viewer/nodejs-java/rendering-to-pdf +title: Render to PDF +weight: 13 +description: "Rendering files to PDF with GroupDocs.Viewer for Java. It means that you can embed PDF in websites or applications by using this Java API" +keywords: embed pdf in website, rendering to pdf, c# api, rendering pdf +productName: GroupDocs.Viewer for Java +hideChildren: False +--- +When rendering to PDF, GroupDocs.Viewer renders all pages of the source document as a single PDF document. + +To render files to PDF, follow these steps: + +1. Create an instance of the [Viewer](#) class. Specify the source document path as a constructor parameter. +2. Instantiate the [PdfViewOptions](#) object. Specify a path to save the rendered file. +3. Call the [View.view()](#) method of the [Viewer](#) object. Specify the [PdfViewOptions](#) object as the parameter. + +The following code snippet shows how to render a .docx document to PDF: + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.docx") +const viewOptions = new groupdocs.viewer.PdfViewOptions(output-to-pdf.pdf) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +For details, please refer to the following pages: diff --git a/nodejs-java/developer-guide/retrieving-document-information/_index.md b/nodejs-java/developer-guide/retrieving-document-information/_index.md new file mode 100644 index 0000000..f15889f --- /dev/null +++ b/nodejs-java/developer-guide/retrieving-document-information/_index.md @@ -0,0 +1,19 @@ +--- +id: retrieving-document-information +url: viewer/nodejs-java/retrieving-document-information +title: Retrieve the document information +weight: 2 +description: "Retrieving information about a document with GroupDocs.Viewer for Node.js" +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- +Once a document is loaded, you can retrieve its properties. For example, you can retrieve the format family and the page count to select a rendering strategy. Also, you can display information about the document during rendering or with the rendered document. + +This section describes how to retrieve the document properties. Also, it shows how to get a list of supported file formats. + +For details, please refer to the following pages: + +{{< alert style="info" >}} +* A file type is a standard way that information is encoded for storage in a computer file. For example, Microsoft Word (.docx) and Adobe PDF (.pdf) are two different file types. +* A format family is a group of several file types for which an application provides additional information. For example, archive files (.7z, .rar, .zip, etc.) or Outlook files (.ost, .pst) are format families. +{{< /alert >}} diff --git a/nodejs-java/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md b/nodejs-java/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md new file mode 100644 index 0000000..54e9d6d --- /dev/null +++ b/nodejs-java/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md @@ -0,0 +1,42 @@ +--- +id: how-to-get-file-type-and-pages-count +url: viewer/nodejs-java/how-to-get-file-type-and-pages-count +title: Get the format family and the additional information +weight: 2 +description: "This article explains how to get the format family and the additional information using Java with GroupDocs.Viewer for Node.js." +keywords: +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +--- +A format family is a group of several file types for which an application provides additional information. For example, archive files (.7z, .rar, .zip, etc.) or Outlook files (.ost, .pst) are format families. + +You can get the format family and the additional information using the [getViewInfo](#) method that returns a [ViewInfo](#) object. + +GroupDocs.Viewer provides additional information for the following format families: + +* Archive files - a collection of folders in the archive (see [Obtain information about folders in an archive file](#); +* CAD drawings - a collection of layouts and layers (see [Obtain information about existing layouts and layers](#)); +* Outlook data files - a collection of folders (see [Obtain information about folders in an Outlook data file](#)); +* PDF documents - a flag that indicates whether document printing is allowed (see [Obtain information about a PDF file](#)); +* Microsoft Project files - the project's start and end dates (see [Obtain information about a Project file](#)). + +## Get the file type and the pages count from a file + +The following code snippet shows how to get the file type and the pages count from a file: + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pdf") +// Get file information. +const viewInfoOptions = ViewInfoOptions.forHtmlView() +const viewInfo = viewer.getViewInfo(viewInfoOptions) +console.log("Document type is: " + viewInfo.getFileType()) +console.log("Pages count: " + viewInfo.getPages().size()) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image shows a sample console output: + +![](/viewer/java/images/how-to-get-file-type-and-pages-count.png) \ No newline at end of file diff --git a/nodejs-java/getting-started/_index.md b/nodejs-java/getting-started/_index.md new file mode 100644 index 0000000..3917973 --- /dev/null +++ b/nodejs-java/getting-started/_index.md @@ -0,0 +1,10 @@ +--- +id: getting-started +url: viewer/nodejs-java/getting-started +title: Get started +weight: 2 +description: "Getting started section for GroupDocs.Viewer for Node.js" +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +isMenuItemWithNoContent: True +--- diff --git a/nodejs-java/getting-started/features-overview.md b/nodejs-java/getting-started/features-overview.md new file mode 100644 index 0000000..b59efb2 --- /dev/null +++ b/nodejs-java/getting-started/features-overview.md @@ -0,0 +1,98 @@ +--- +id: features-overview +url: viewer/nodejs-java/features-overview +title: Features overview +weight: 1 +description: "With GroupDocs.Viewer for Node.js you can render files to HTML, PNG, JPEG and PDF formats, list and save attachments, embedded files and compressed files, and extract document text." +keywords: render files,viewer,html,PNG,JPEG,PDF +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- + +## Rendering Documents + +We use the term ["rendering"]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/_index.md" >}}) in GroupDocs.Viewer to describe the process of converting a document into a file format, paginated, or that has the concept of pages. For example, when you have a DOCX file with three pages then after rendering this file to HTML you will get three HTML files on the output that represent each of the pages in the document. + +![Rendering diagram](/viewer/net/images/getting-started/features-overview/rendering.png) + +### Rendering to HTML + +Rendering to HTML will suit the best when you have the following requirements: + +* You are writing a web-based application; +* Document content should be displayed inside web-browser; +* You need an ability to interact with rendered document text - select, copy or search; +* You want to view document pages separately; +* Zooming in a document without quality loss for most cases; +* You want to rotate, reorder pages or add watermarks. + +GroupDocs.Viewer for Node.js provides two resources management options for CSS, fonts, images, etc.: + +* Rendering to **HTML with external resources** - stores page resources near to HTML which allows to reuse common resources across separate pages and dramatically reduce page size and loading speed. +* Rendering to **HTML with embedded resources** - integrates page resources into HTML and makes each document page self-sufficient. The drawback is that page size and loading speed may decrease. + +### Rendering to PNG or JPEG + +Rendering to PNG or JPEG will suit the best when you have the following requirements: + +* You are writing any type of application; +* You don’t need to render textual content or want to restrict interaction with rendered document text. For example: prevent text copying. There is still an ability for you to extract document text if you want to add selectable text layer over the page image (described below). +* You want to view document pages separately; +* You want to rotate, reorder pages or add watermarks. + +Following is a brief description of both image formats which may help you to choose the most suitable for your case. + +* **PNG** **format** is a lossless raster graphics file format that works with full-color images and supports transparency. There is no ability to adjust the quality of saved PNG image. PNG is a good choice for storing line drawings, text, and iconic graphics at small file sizes. +* **JPEG** **format** is a lossy compressed file format which allows to adjust the quality of the saved image — when it is reduced, the details are removed and noise is added to the image, but the size becomes more compact. JPEG is optimal for images with a large number of colors (for example, for photos). It’s is a common choice to use JPEG on the Web because of its compression. + +### Rendering to PDF + +GroupDocs.Viewer renders a document to a single PDF document, so rendering to PDF will suit the best when you have the following requirements: + +* You are going to print documents; +* You want to send documents via email. +* You don’t want to display document pages separately since all pages of a source document are rendered as a single PDF document. + +## Retrieving Document Information + +GroupDocs.Viewer for Node.js allows to obtain basic information about source documents such as file type, pages count, text with coordinates, etc. + +For the following document formats additional information can also be extracted: + +* Archive – list of folders contained in archive; +* CAD - list of layers and layouts in a CAD document; +* Email – list of folders contained in an Outlook data file document; +* PDF – information about document printing restrictions; +* Project Management – project start and end dates. + +### Text extraction + +You can opt to extract document text when rendering to PNG or JPEG, document text can be extracted along with separate words coordinates. + +This may be helpful when you want to add selectable text layer over the page image. + +## Processing attachments + +We use the term "attachments" in GroupDocs.Viewer for email attachments, embedded files, and compressed files. + +With GroupDocs.Viewer you can list and save: + +* Email attachments; +* Files that are embedded in PDF files; +* Email messages contained by Outlook and LotusNotes data files; +* Compressed files. + +## Output transformation + +GroupDocs.Viewer for Node.js provides a set of options to apply different document page transformations: + +* Rotate pages - change page orientation when rendering to HTML, JPG, PNG and PDF. +* Add text watermark - add text watermark to each of the rendered pages. +* Reorder pages - render pages in order you prefer or reorder pages when rendering to PDF. + +## Caching results + +GroupDocs.Viewer for Node.js provides a document viewer API that supports caching in order to boost document loading speed and optimize application performance. + +Documents cache is saved to a local disk by default. However, document viewer API also provides document cache interfaces that can be implemented for 3rd party storage support - FTP, Amazon S3, Dropbox, Google Drive, Microsoft Azure, Redis or any other. diff --git a/nodejs-java/getting-started/how-to-run-examples.md b/nodejs-java/getting-started/how-to-run-examples.md new file mode 100644 index 0000000..0edb890 --- /dev/null +++ b/nodejs-java/getting-started/how-to-run-examples.md @@ -0,0 +1,32 @@ +--- +id: how-to-run-examples +url: viewer/nodejs-java/how-to-run-examples +title: How to run examples +weight: 6 +description: "How to run examples." +keywords: "groupdocs viewer node.js, examples, npm, eclipse ide" +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- + +The complete project [GroupDocs.Viewer Examples](https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java) with code examples and sample files is hosted at GitHub. + +## Run examples using NPM + +To get started make sure that [Node.js](https://nodejs.org) is installed. + +1. Clone repository with examples `git clone https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java.git` +2. Navigate to the examples folder `cd ./GroupDocs.Viewer-for-Node.js-via-Java/` +3. Install the necessary packages with the `npm install` command. +4. Navigate to the examples folder `cd ./Examples` +5. Run the examples with the `node runExamples.js` command. + +To check what examples are available open `Examples/runExamples.js` file using your favorite text editor. Uncomment examples that you want to run and type `node runExamples.js` to start them. + + +## Contribute + +If you like to add or improve an example, we encourage you to contribute to the project. All examples in this repository are open source and can be freely used in your own applications. + +To contribute, you can fork the repository, edit the source code and create a pull request. We will review the changes and include them in the repository if found helpful. \ No newline at end of file diff --git a/nodejs-java/getting-started/installation.md b/nodejs-java/getting-started/installation.md new file mode 100644 index 0000000..557cbd1 --- /dev/null +++ b/nodejs-java/getting-started/installation.md @@ -0,0 +1,21 @@ +--- +id: installation +url: viewer/nodejs-java/installation +title: Install GroupDocs.Viewer for Node.js via Java +linkTitle: Installation +weight: 4 +keywords: installation, maven +description: "This topic describes how to install GroupDocs.Viewer for Node.js." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- + +## Install using NPM + +All Java packages are hosted at [NPM](https://www.npmjs.com/package/@groupdocs/groupdocs.viewer). You can easily reference GroupDocs.Viewer for Node.js via Java API directly in your Node.js project by installing it with the following command. + +```batch +npm install @groupdocs/groupdocs.viewer +``` + diff --git a/nodejs-java/getting-started/licensing-and-subscription.md b/nodejs-java/getting-started/licensing-and-subscription.md new file mode 100644 index 0000000..6fa0d72 --- /dev/null +++ b/nodejs-java/getting-started/licensing-and-subscription.md @@ -0,0 +1,98 @@ +--- +id: licensing-and-subscription +url: viewer/nodejs-java/licensing-and-subscription +title: Licensing +weight: 5 +keywords: free, free trial, evaluation, groupdocs viewer java +description: "GroupDocs.Viewer for Node.js provides different plans for purchase or offers a Free Trial and a 30-day Temporary License for evaluation." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- +Sometimes, in order to study the system better, you want to dive into the code as fast as possible. To make this easier, GroupDocs.Viewer provides different plans for purchase or offers a Free Trial and a 30-day Temporary License for evaluation. + +{{< alert style="info" >}} + +Note that there are a number of general policies and practices that guide you on how to evaluate, properly license, and purchase our products. You can find them in the ["Purchase Policies and FAQ"](https://purchase.groupdocs.com/policies) section. + +{{< /alert >}} + +## Free Trial or Temporary License + +You can try GroupDocs.Viewer without buying a license. + +### Free Trial + +The evaluation version is the same as the purchased one – the evaluation version simply becomes licensed when you set the license. You can set the license in a number of ways that described in the next sections of this article. + +The evaluation version comes with the limitations: + +- Only first 2 pages can be rendered. +- Trial badges are placed in the rendering results on the top of each page. + +### Temporary License + +If you wish to test GroupDocs.Viewer without the limitations of the trial version, you can also request a 30-day Temporary License. For more details, see the ["Get a Temporary License"](https://purchase.groupdocs.com/temporary-license) page. + +## How to set a license + +{{< alert style="info" >}} + +You can find pricing information at ["Pricing Information"](https://purchase.groupdocs.com/pricing/viewer/nodejs-java) page. + +{{< /alert >}} + +After the license is obtained you need to set the license. This section describes options of how this can be done, and also comments on some common questions. + +The license should be set: + +- Only once per application domain, +- and before using any other GroupDocs.Viewer classes. + +{{< alert style="info" >}} + +The license can be set multiple times per app domain but we recommend doing it once since all calls to `setLicense` except first will just waste processor time. + +{{< /alert >}} + +### Set License from File + +The following code sets a license from file. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} + +```js +const licensePath = "path to the .lic file"; +const license = new groupdocs.viewer.License() +license.setLicense(licensePath); +``` + +{{< /tab >}} +{{< /tabs >}} + + +### Set License from Stream + +The following example shows how to set a license from a stream. + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} + +```js +const fs = require('fs') + +const licensePath = "path to the .lic file" +const license = new groupdocs.viewer.License() +const licStream = fs.createReadStream(licensePath) +groupdocs.conversion.License.setLicenseFromStream(license, licStream, err => { + if (err) { + console.log(`Set license error: ${err}`) + } else { + console.log('License set OK') + } +}) +``` + +{{< /tab >}} +{{< /tabs >}} \ No newline at end of file diff --git a/nodejs-java/getting-started/supported-document-formats.md b/nodejs-java/getting-started/supported-document-formats.md new file mode 100644 index 0000000..06b01fa --- /dev/null +++ b/nodejs-java/getting-started/supported-document-formats.md @@ -0,0 +1,296 @@ +--- +id: supported-document-formats +url: viewer/nodejs-java/supported-document-formats +title: Supported file formats +weight: 2 +keywords: file formats, Microsoft Word, Microsoft Excel, Microsoft PowerPoint, PDF, HTML, Python Script, TAR, ZIP, DWG +description: "This topic lists file formats supported by GroupDocs.Viewer for Node.js." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- +This topic lists file formats supported by GroupDocs.Viewer for Node.js. + +## Archive and compression file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [BZ2](https://docs.fileformat.com/compression/bz2) | Bzip2 Compressed File | ![(tick)](/viewer/java/images/check-blue.png) | +| [GZ](https://docs.fileformat.com/compression/gz) | Gnu Zipped Archive | ![(tick)](/viewer/java/images/check-blue.png) | +| [RAR](https://docs.fileformat.com/compression/rar) | WinRAR Compressed Archive | ![(tick)](/viewer/java/images/check-blue.png) | +| [TAR](https://docs.fileformat.com/compression/tar) | Consolidated Unix File Archive | ![(tick)](/viewer/java/images/check-blue.png) | +| [TGZ](https://docs.fileformat.com/compression/tgz/) | Gzipped Tar File | ![(tick)](/viewer/java/images/check-blue.png) | +| [TXZ](https://docs.fileformat.com/compression/xz/) | XZ Compressed Tar Archive | ![(tick)](/viewer/java/images/check-blue.png) | +| [XZ](https://docs.fileformat.com/compression/xz/) | XZ Compressed Archive | ![(tick)](/viewer/java/images/check-blue.png) | +| [ZIP](https://docs.fileformat.com/compression/zip) | Zipped File | ![(tick)](/viewer/java/images/check-blue.png) | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view archive files: [Render archives as HTML, PDF, and image files](/viewer/nodejs-java/render-archive-files). + +## CAD and 3D file formats + +| Format | Description | Automatic format detection | Remarks | +| --- | --- | :---: | --- | +| [CF2](https://docs.fileformat.com/cad/cf2/) | Common File Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DGN](https://docs.fileformat.com/cad/dgn) | MicroStation Design File (V7) | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DWF](https://docs.fileformat.com/cad/dwf/) | Design Web Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DWG](https://docs.fileformat.com/cad/dwg/) | AutoCAD Drawing | ![(tick)](/viewer/java/images/check-blue.png) | Supported formats:
Release 11, 12, 13, 14.
DWG 2000, 2000i, 2002.
DWG 2004, 2005, 2006.
DWG 2010, 2011, 2012.
DWG 2013, 2014, 2015, 2016. | +| [DWT](https://docs.fileformat.com/cad/dwt/) | AutoCAD Drawing Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DXF](https://docs.fileformat.com/cad/dxf/) | Drawing Exchange Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [HPG](https://docs.fileformat.com/cad/hpgl/) | HPGL (Hewlett-Packard Graphics Language) Plot File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [IFC](https://docs.fileformat.com/cad/ifc/) | Industry Foundation Classes | ![(tick)](/viewer/java/images/check-blue.png) | | +| [IGS](https://docs.fileformat.com/cad/igs/) | IGES (Initial Graphics Exchange Specification) Drawing | ![(tick)](/viewer/java/images/check-blue.png) | +| [OBJ](https://docs.fileformat.com/3d/obj/) | Wavefront 3D Object File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PLT](https://docs.fileformat.com/cad/plt/) | AutoCAD Plotter Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [STL](https://docs.fileformat.com/cad/stl/) | Stereolithography File | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view CAD files: [Render CAD drawings and models as HTML, PDF, and image files](/viewer/nodejs-java/render-cad-drawings-and-models). + +## Database file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [NSF](https://docs.fileformat.com/database/nsf/) | Lotus Notes Database File | ![(tick)](/viewer/java/images/check-blue.png) | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view NSF files: [Render Lotus Notes database files as HTML, PDF, and image files](/viewer/nodejs-java/render-lotus-notes-database-files/). + +## EBook file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | --- | +| [EPUB](https://docs.fileformat.com/ebook/epub/) | Open EBook Format | ![(tick)](/viewer/java/images/check-blue.png) | +| [MOBI](https://docs.fileformat.com/ebook/mobi/) | Mobipocket EBook | ![(tick)](/viewer/java/images/check-blue.png) | + +## Email file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [EML](https://docs.fileformat.com/email/eml/) | Email Message | ![(tick)](/viewer/java/images/check-blue.png) | +| [EMLX](https://docs.fileformat.com/email/emlx/) | Apple Mail Message | ![(tick)](/viewer/java/images/check-blue.png) | +| [MBOX](https://docs.fileformat.com/email/mbox/) | Email Mailbox File | ![(tick)](/viewer/java/images/check-blue.png) | +| [MSG](https://docs.fileformat.com/email/msg/) | Outlook Message Item File | ![(tick)](/viewer/java/images/check-blue.png) | +| [VCARD / VCF](https://docs.fileformat.com/email/vcf/) | vCard (Virtual Contact) File | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view email messages: [Render email messages as HTML, PDF, PNG, and JPEG files](/viewer/nodejs-java/render-email-messages/). + +## Image file formats + +| Format | Description | Automatic format detection | Remarks | +| --- | --- | :---: | --- | +| [AI](https://docs.fileformat.com/image/ai/) | Adobe Illustrator Artwork | ![(tick)](/viewer/java/images/check-blue.png) | Supported versions: 2, 3, 8 | +| [APNG](https://docs.fileformat.com/image/apng/) | Animated Portable Network Graphic | ![(tick)](/viewer/java/images/check-blue.png) | | +| [BMP](https://docs.fileformat.com/image/bmp/) | Bitmap Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [CDR](https://docs.fileformat.com/image/cdr/) | CorelDRAW Image File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [CGM](https://docs.fileformat.com/page-description-language/cgm/) | Computer Graphics Metafile | ![(tick)](/viewer/java/images/check-blue.png) | | +| [CMX](https://docs.fileformat.com/image/cmx/) | Corel Presentation Exchange Image | ![(tick)](/viewer/java/images/check-blue.png) | Supported version: 2.0 with 32-bit precision (16-bit precision is partially supported). | +| [DCM](https://docs.fileformat.com/image/dcm/) | DICOM (Digital Imaging and Communications in Medicine) Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DIB](https://docs.fileformat.com/image/dib/) | Device Independent Bitmap File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DJVU](https://docs.fileformat.com/image/djvu/) | DjVu Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DNG](https://docs.fileformat.com/image/dng/) | Digital Negative Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [EMF](https://docs.fileformat.com/image/emf/) | Enhanced Windows Metafile | ![(tick)](/viewer/java/images/check-blue.png) | | +| [EMZ](https://docs.fileformat.com/image/emz/) | Windows Compressed Enhanced Metafile | ![(tick)](/viewer/java/images/check-blue.png) | | +| [EPS](https://docs.fileformat.com/page-description-language/eps/) | Encapsulated PostScript File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [FODG](https://docs.fileformat.com/image/jpc/) | OpenDocument Flat XML Graphics | ![(tick)](/viewer/java/images/check-blue.png) | | +| [GIF](https://docs.fileformat.com/image/gif/) | Graphical Interchange Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [ICO](https://docs.fileformat.com/image/ico/) | Windows Icon File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [J2C](https://docs.fileformat.com/image/j2c/) | JPEG 2000 Code Stream | ![(tick)](/viewer/java/images/check-blue.png) | | +| [J2K](https://docs.fileformat.com/image/j2k/) | JPEG 2000 Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [JP2](https://docs.fileformat.com/image/jp2/) | JPEG 2000 Core Image File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [JPC](https://docs.fileformat.com/image/jpc/) | JPEG 2000 Code Stream File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [JPEG / JPG](https://docs.fileformat.com/image/jpeg) | JPEG Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [JPF](https://docs.fileformat.com/image/jpf/) | JPEG 2000 Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [JPM](https://docs.fileformat.com/image/jpm/) | JPEG 2000 Multi-layer Image Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [JPX](https://docs.fileformat.com/image/jpx/) | JPEG 2000 Image File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [ODG](https://docs.fileformat.com/image/odg/) | OpenDocument Graphics File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [OTG](https://docs.fileformat.com/image/otg/) | OpenDocument Graphics Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PCL](https://docs.fileformat.com/page-description-language/pcl/) | Printer Command Language Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PNG](https://docs.fileformat.com/image/png/) | Portable Network Graphics | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PS](https://docs.fileformat.com/page-description-language/ps/) | PostScript File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PSB](https://docs.fileformat.com/image/psb/) | Photoshop Large Document Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PSD](https://docs.fileformat.com/image/psd/) | Adobe Photoshop Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [SVG](https://docs.fileformat.com/page-description-language/svg/) | Scalable Vector Graphics File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [SVGZ](https://docs.fileformat.com/image/svgz/) | Compressed SVG File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [TGA](https://docs.fileformat.com/image/tga/) | TARGA (Truevision Advanced Raster Graphics Adapter) Graphics | ![(tick)](/viewer/java/images/check-blue.png) | | +| [TIF / TIFF](https://docs.fileformat.com/image/tiff/) | Tagged Image File Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [WEBP](https://docs.fileformat.com/image/webp/) | WebP Image | ![(tick)](/viewer/java/images/check-blue.png) | | +| [WMF](https://docs.fileformat.com/image/wmf/) | Windows Metafile | ![(tick)](/viewer/java/images/check-blue.png) | | +| [WMZ](https://docs.fileformat.com/image/wmz/) | Compressed Windows Metafile | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view image files: [Render images as HTML, PDF, PNG, and JPEG files](/viewer/nodejs-java/render-images/). + +## Note-taking file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [ONE](https://docs.fileformat.com/note-taking/one/) | Microsoft OneNote Document | ![(tick)](/viewer/java/images/check-blue.png) | | + +## Outlook data file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [OST](https://docs.fileformat.com/email/ost/) | Outlook Offline Storage Table | ![(tick)](/viewer/java/images/check-blue.png) | +| [PST](https://docs.fileformat.com/email/pst/) | Outlook Personal Storage Table | ![(tick)](/viewer/java/images/check-blue.png) | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view Microsoft Outlook data files: [Render Outlook data files as HTML, PDF, and image files](/viewer/nodejs-java/render-outlook-data-files/). + +## PDF and Page Layout file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [OXPS](https://docs.fileformat.com/page-description-language/oxps/) | OpenXPS (Open XML Paper Specification) File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PDF](https://docs.fileformat.com/pdf/) | Adobe Portable Document Format | ![(tick)](/viewer/java/images/check-blue.png) | | +| [TEX](https://docs.fileformat.com/page-description-language/tex/) | LaTeX Source Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XPS](https://docs.fileformat.com/page-description-language/xps/) | Microsoft XML Paper Specification | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view PDF files: [Render PDF documents as HTML and image files](/viewer/nodejs-java/render-pdf-documents/). + +## Presentation file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [FODP](https://docs.fileformat.com/) | OpenDocument Flat XML Presentation | ![(tick)](/viewer/java/images/check-blue.png) | | +| [ODP](https://docs.fileformat.com/presentation/odp/) | OpenDocument Presentation | ![(tick)](/viewer/java/images/check-blue.png) | | +| [OTP](https://docs.fileformat.com/presentation/otp/) | OpenDocument Presentation Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [POT](https://docs.fileformat.com/presentation/pot/) | Microsoft PowerPoint 97-2003 Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [POTM](https://docs.fileformat.com/presentation/potm/) | Microsoft PowerPoint Macro-Enabled Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [POTX](https://docs.fileformat.com/presentation/potx/) | Microsoft PowerPoint Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PPS](https://docs.fileformat.com/presentation/pps/) | Microsoft PowerPoint 97-2003 Slide Show | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PPSM](https://docs.fileformat.com/presentation/ppsm/) | Microsoft PowerPoint Macro-Enabled Slide Show | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PPSX](https://docs.fileformat.com/presentation/ppsx/) | Microsoft PowerPoint Slide Show | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PPT](https://docs.fileformat.com/presentation/ppt/) | Microsoft PowerPoint 97-2003 Presentation | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PPTM](https://docs.fileformat.com/presentation/pptm/) | Microsoft PowerPoint Macro-Enabled Presentation | ![(tick)](/viewer/java/images/check-blue.png) | | +| [PPTX](https://docs.fileformat.com/presentation/pptx/) | Microsoft PowerPoint Presentation | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view presentations: [Render PowerPoint presentations as HTML, PDF, and image files](/viewer/nodejs-java/render-presentations/). + +## Project Management file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [MPP](https://docs.fileformat.com/project-management/mpp/) | Microsoft Project | ![(tick)](/viewer/java/images/check-blue.png) | | +| [MPT](https://docs.fileformat.com/project-management/mpt/) | Microsoft Project Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [MPX](https://docs.fileformat.com/project-management/mpx/) | Microsoft Project Exchange File | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view Project files: [Render Microsoft Project documents as HTML, PDF, and image files](/viewer/nodejs-java/render-ms-project-files/). + +## Spreadsheet file formats + +| Format | Description | Automatic format detection | Remarks | +| --- | --- | :---: | --- | +| [CSV](https://docs.fileformat.com/spreadsheet/csv/) | Comma Separated Values File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [FODS](https://docs.fileformat.com/spreadsheet/fods/) | OpenDocument Flat XML Spreadsheet | ![(tick)](/viewer/java/images/check-blue.png) | | +| [NUMBERS](https://docs.fileformat.com/spreadsheet/numbers/) | Apple Numbers Spreadsheet | ![(tick)](/viewer/java/images/check-blue.png) | GroupDocs.Viewer supports version 3.5 and higher starting with v21.8. +| [ODS](https://docs.fileformat.com/spreadsheet/ods/) | OpenDocument Spreadsheet | ![(tick)](/viewer/java/images/check-blue.png) | | +| [OTS](https://docs.fileformat.com/spreadsheet/ots/) | OpenDocument Spreadsheet Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [SXC](https://docs.fileformat.com/spreadsheet/sxc/) | StarOffice Calc Spreadsheet | ![(tick)](/viewer/java/images/check-blue.png) | | +| [TSV](https://docs.fileformat.com/spreadsheet/tsv/) | Tab Separated Values File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XLS](https://docs.fileformat.com/spreadsheet/xls/) | Microsoft Excel 97-2003 Workbook | ![(tick)](/viewer/java/images/check-blue.png) | Supported formats: Excel 2003 (11.0), Excel 2002 (10.0), Excel 2000 (9.0), Excel 97 (8.0), Excel 95 (7.0), Excel 5.0. | +| [XLSB](https://docs.fileformat.com/spreadsheet/xlsb/) | Microsoft Excel Binary Workbook | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XLSM](https://docs.fileformat.com/spreadsheet/xlsm/) | Microsoft Excel Macro-Enabled Workbook | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XLSX](https://docs.fileformat.com/spreadsheet/xlsx/) | Microsoft Excel Workbook | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XLT](https://docs.fileformat.com/spreadsheet/xlt/) | Microsoft Excel 97-2003 Template | ![(tick)](/viewer/java/images/check-blue.png) | Supported formats: Excel 2003 (11.0), Excel 2002 (10.0), Excel 2000 (9.0), Excel 97 (8.0). | +| [XLTX](https://docs.fileformat.com/spreadsheet/xltx/) | Microsoft Excel Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XLTM](https://docs.fileformat.com/spreadsheet/xltm/) | Microsoft Excel Macro-Enabled Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XLAM](https://docs.fileformat.com/spreadsheet/xlam/) | Microsoft Excel Add-In | ![(tick)](/viewer/java/images/check-blue.png) | | +| [XML](https://docs.fileformat.com/spreadsheet/) | XML Spreadsheet 2003 | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view spreadsheet files: [Render Excel and Apple Numbers spreadsheets as HTML, PDF, and image files](/viewer/nodejs-java/render-excel-and-apple-numbers-spreadsheets/). + +## Text and programming file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | --- | +| [AS / AS3](https://docs.fileformat.com/programming/as/) | ActionScript File | | +| [ASM](https://docs.fileformat.com/programming/asm/) | Assembly Language Source Code File | | +| [BAT](https://docs.fileformat.com/executable/bat/) | DOS Batch File | | +| [C](https://docs.fileformat.com/programming/c/) | C/C++ Source Code File | | +| [CC](https://docs.fileformat.com/programming/c/) | C++ Source Code File | | +| [CMAKE](https://docs.fileformat.com/programming/cmake/) | CMake File | | +| [CPP](https://docs.fileformat.com/programming/cpp/) | C++ Source Code File | | +| [CS](https://docs.fileformat.com/specification/programming/cs/) | C# Source Code File | ![(tick)](/viewer/java/images/check-blue.png) | +| [CSS](https://docs.fileformat.com/web/css/) | Cascading Style Sheet | | +| [CXX](https://docs.fileformat.com/programming/cxx/) | C++ Source Code File | | +| [DIFF](https://docs.fileformat.com/programming/diff/) | Patch File | | +| [ERB](https://docs.fileformat.com/programming/erb/) | Ruby ERB Script | | +| [GROOVY](https://docs.fileformat.com/programming/groovy/) | Groovy Source Code File | | +| [H](https://docs.fileformat.com/programming/h/) | C/C++/Objective-C Header File | | +| [HAML](https://docs.fileformat.com/programming/haml/) | Haml Source Code File | | +| [HH](https://docs.fileformat.com/programming/hh/) | C++ Header File | | +| [JAVA](https://docs.fileformat.com/programming/nodejs-java/) | Java Source Code File | | +| [JS](https://docs.fileformat.com/web/js/) | JavaScript File | | +| [JSON](https://docs.fileformat.com/web/json/) | JavaScript Object Notation File | | +| [LESS](https://docs.fileformat.com/web/less/) | LESS Style Sheet | | +| [LOG](https://docs.fileformat.com/database/log/) | Log File | | +| [M](https://docs.fileformat.com/programming/m/) | Objective-C Implementation File | | +| [MAKE](https://docs.fileformat.com/programming/make/) | Xcode Makefile Script | | +| [MD](https://docs.fileformat.com/word-processing/md/) | Markdown Documentation File | | +| [ML](https://docs.fileformat.com/programming/ml/) | ML Source Code File | | +| [MM](https://docs.fileformat.com/programming/mm/) | Objective-C++ Source File | | +| [PHP](https://docs.fileformat.com/programming/php/) | PHP Source Code File | | +| [PL](https://docs.fileformat.com/programming/pl/) | Perl Script | | +| [PROPERTIES](https://en.wikipedia.org/wiki/.properties) | Java Properties File | | +| [PY](https://docs.fileformat.com/programming/py/) | Python Script | | +| [RB](https://docs.fileformat.com/ebook/rb/) | Ruby Source Code | | +| [RST](https://docs.fileformat.com/programming/rst/) | reStructuredText File | | +| [SASS](https://docs.fileformat.com/web/sass/) | Syntactically Awesome StyleSheets File | | +| [SCALA](https://docs.fileformat.com/programming/scala/) | Scala Source Code File | | +| [SCM](https://docs.fileformat.com/programming/scm/) | Scheme Source Code File | | +| [SCRIPT](https://docs.fileformat.com/programming/script/) | Generic Script File | | +| [SH](https://docs.fileformat.com/programming/sh/) | Bash Shell Script | | +| [SML](https://en.wikipedia.org/wiki/Standard_ML) | Standard ML Source Code File | | +| [SQL](https://docs.fileformat.com/database/sql/) | Structured Query Language Data File | | +| [TXT](https://docs.fileformat.com/word-processing/txt) | Plain Text File | ![(tick)](/viewer/java/images/check-blue.png) | +| [VB](https://docs.fileformat.com/specification/programming/vb/) | Visual Basic Source Code File | ![(tick)](/viewer/java/images/check-blue.png) | +| [VIM](https://docs.fileformat.com/misc/vim/) | Vim Settings File | | +| [XML](https://docs.fileformat.com/web/xml/) | XML File | ![(tick)](/viewer/java/images/check-blue.png) | +| [YAML](https://docs.fileformat.com/programming/yaml/) | YAML Document | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view text and code files: [Render text documents as HTML, PDF, and image files](/viewer/nodejs-java/render-text-files/). + +## Visio file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [VDW](https://docs.fileformat.com/web/vdw/) | Visio Web Drawing | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VDX](https://docs.fileformat.com/image/vdx/) | Visio Drawing XML File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSD](https://docs.fileformat.com/image/vsd/) | Visio 2003-2010 Drawing | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSDM](https://docs.fileformat.com/image/vsdm/) | Visio Macro-Enabled Drawing | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSDX](https://docs.fileformat.com/image/vsdx/) | Visio Drawing | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSS](https://docs.fileformat.com/image/vss/) | Visio 2003-2010 Stencil | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSSM](https://docs.fileformat.com/image/vssm/) | Visio Macro-Enabled Stencil | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSSX](https://docs.fileformat.com/image/vssx/) | Visio Stencil | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VST](https://docs.fileformat.com/image/vst/) | Visio 2003-2010 Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSTM](https://docs.fileformat.com/image/vstm/) | Visio Macro-Enabled Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSTX](https://docs.fileformat.com/image/vstx/) | Visio Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VSX](https://docs.fileformat.com/image/vsx/) | Visio Stencil XML File | ![(tick)](/viewer/java/images/check-blue.png) | | +| [VTX](https://docs.fileformat.com/image/vtx/) | Visio Template XML File | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view Microsoft Visio files: [Render Visio documents as HTML, PDF, and image files](/viewer/nodejs-java/render-visio-documents/). + +## Web file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [CHM](https://docs.fileformat.com/web/chm/) | Compiled HTML Help Format | ![(tick)](/viewer/java/images/check-blue.png) | +| [HTML](https://docs.fileformat.com/web/html/) | Hypertext Markup Language Format | ![(tick)](/viewer/java/images/check-blue.png) | +| [MHT](https://docs.fileformat.com/web/mht/) | MHTML Web Archive | ![(tick)](/viewer/java/images/check-blue.png) | +| [MHTML](https://docs.fileformat.com/web/mhtml/) | MIME HTML Format | ![(tick)](/viewer/java/images/check-blue.png) | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view web files: [Render web documents as PDF, PNG, and JPEG files](/viewer/nodejs-java/render-web-documents/). + +## Word processing file formats + +| Format | Description | Automatic format detection | +| --- | --- | :---: | +| [DOC](https://docs.fileformat.com/word-processing/doc/) | Microsoft Word 97-2003 Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DOCM](https://docs.fileformat.com/word-processing/docm/) | Microsoft Word Macro-Enabled Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DOCX](https://docs.fileformat.com/word-processing/docx/) | Microsoft Word Document | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DOT](https://docs.fileformat.com/word-processing/dot/) | Microsoft Word 97-2003 Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DOTM](https://docs.fileformat.com/word-processing/dotm/) | Microsoft Word Macro-Enabled Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [DOTX](https://docs.fileformat.com/word-processing/dotx/) | Microsoft Word Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [ODT](https://docs.fileformat.com/word-processing/odt/) | OpenDocument Text | ![(tick)](/viewer/java/images/check-blue.png) | | +| [OTT](https://docs.fileformat.com/word-processing/ott/) | OpenDocument Text Template | ![(tick)](/viewer/java/images/check-blue.png) | | +| [RTF](https://docs.fileformat.com/word-processing/rtf/) | Rich Text Document | ![(tick)](/viewer/java/images/check-blue.png) | | + +Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view Word documents: [Render Word documents as HTML, PDF, and image files](/viewer/nodejs-java/render-word-documents/). + + diff --git a/nodejs-java/getting-started/system-requirements.md b/nodejs-java/getting-started/system-requirements.md new file mode 100644 index 0000000..9d4ef1d --- /dev/null +++ b/nodejs-java/getting-started/system-requirements.md @@ -0,0 +1,54 @@ +--- +id: system-requirements +url: viewer/nodejs-java/system-requirements +title: System requirements +weight: 3 +description: "GroupDocs.Viewer for Node.js via Java does not require any external software to be installed such as Microsoft Word, Microsoft Excel or Microsoft PowerPoint for file rendering." +keywords: file rendering +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +--- +{{< alert style="info" >}} + +GroupDocs.Viewer for Node.js via Java does not require any external software to be installed such as Microsoft Word, Microsoft Excel or Microsoft PowerPoint. To install GroupDocs.Viewer for Node.js just follow one of the ways as described in the [Installation]({{< ref "installation" >}}) section. + +{{< /alert >}} + +## Supported Operating Systems + +GroupDocs.Viewer for Node.js can be used on any 32-bit or 64-bit operating system where Java is installed including, but not limited to: + +### Windows + +* Microsoft Windows Server 2003 and later +* Microsoft Windows XP (x64, x86) +* Microsoft Windows Vista (x64, x86) +* Microsoft Windows 7, 8, 8.1 (x64, x86) +* Microsoft Windows 10 (x64, x86) +* Microsoft Windows 11 (x64) + +### Linux + +* Linux (Ubuntu, OpenSUSE, CentOS and others) + +### Mac + +* Mac OS X + +## Supported Frameworks + +GroupDocs.Viewer for Node.js supports frameworks versions listed below. For more platform support please check [GroupDocs.Viewer](https://products.groupdocs.com/viewer) page. + +* Node.js 16 or above +* J2SE 8.0 (1.8) or above (*for example Java 17*) + +## Development Environments + +GroupDocs.Viewer for Node.js can be used to develop applications in any development environment that targets Java, but the following environments are explicitly supported: + +* Eclipse +* IntelliJ NetBeans +* IntelliJ IDEA +* VS Code etc. + \ No newline at end of file diff --git a/nodejs-java/product-overview.md b/nodejs-java/product-overview.md new file mode 100644 index 0000000..ce119d4 --- /dev/null +++ b/nodejs-java/product-overview.md @@ -0,0 +1,50 @@ +--- +id: product-overview +url: viewer/nodejs-java/product-overview +title: GroupDocs.Viewer for Node.js overview +linkTitle: Product overview +weight: 1 +description: "GroupDocs.Viewer for Node.js enables you to convert files to HTML, PNG, JPEG, PDF file formats, and save attachments without relying on third-party applications. GroupDocs.Viewer for Node.js is cross-platform class library." +keywords: convert files, render files, view files, HTML, PDF, PNG, JPEG +productName: GroupDocs.Viewer for Node.js via Java +toc: True +--- +GroupDocs.Viewer for Node.js is a high-performance and cross-platform library that allows you to build desktop and web [file viewer applications](https://en.wikipedia.org/wiki/File_viewer). + +With its powerful and straightforward API, you can execute the following actions: + +* View documents in the [most popular file formats](/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. You no longer need third-party software to view files within your Java application. +* Load documents from [different sources](/viewer/nodejs-java/loading-documents-from-different-sources/) (a file, a stream, a URL, an FTP server, Amazon S3, Azure Blob Storage, and so on). +* Open [password-protected documents](/viewer/nodejs-java/load-password-protected-document/). +* Render the entire document or specific pages. +* Embed all external resources in the output HTML files, generate [responsive](/viewer/nodejs-java/render-with-responsive-layout/) and [minified](/viewer/nodejs-java/minify-html/) HTML pages. +* [Protect](/viewer/nodejs-java/protect-pdf-documents/) the output PDF files and [reorder their pages](/viewer/nodejs-java/reorder-pages/). +* [Rotate pages](/viewer/nodejs-java/flip-or-rotate-pages/) in the output files. +* Specify whether to render notes and comments contained in the source document. +* Extract text from PDF files and images. +* [Extract archive contents](/viewer/nodejs-java/how-to-extract-and-save-attachments/) and [save files](/viewer/nodejs-java/how-to-extract-and-save-attachments/) attached to PDF documents, email messages, and Outlook data files. +* [Obtain basic information](/viewer/nodejs-java/how-to-get-file-type-and-pages-count/) about the source document (the file type, number of pages, and page information). +* [Replace missing document fonts](/viewer/nodejs-java/replace-missing-font/) or [specify a folder](/viewer/nodejs-java/set-custom-fonts/) where GroupDocs.Viewer should look for these fonts. +* [Add text watermarks](/viewer/nodejs-java/add-text-watermark/) to the output HTML, PDF, and image files. +* [Implement caching](/viewer/nodejs-java/caching-results/) to increase document loading speed and optimize application performance. + +You can use GroupDocs.Viewer across multiple platforms and operation systems: + +* Windows, Linux, and macOS +* Java Framework 2.0 and higher +* Java Core 3.1 +* Java 5 and higher + +## Get started with GroupDocs.Viewer for Node.js + +If you are new to GroupDocs.Viewer, see the following topics first: + +* [System requirements](/viewer/nodejs-java/system-requirements/) +* [Installation](/viewer/nodejs-java/installation/) +* [Licensing](/viewer/nodejs-java/licensing-and-subscription/) +* [Document rendering basics](/viewer/nodejs-java/document-rendering-basics/) + +## Technical support + +If you encounter an issue while using GroupDocs.Viewer or have a technical question, feel free to create a post in our [Free Support Forum](https://forum.groupdocs.com/c/viewer/9). If free support is not sufficient, you can submit a ticket to our [Paid Support Helpdesk](https://helpdesk.groupdocs.com/). + diff --git a/nodejs-java/rendering-basics/_index.md b/nodejs-java/rendering-basics/_index.md new file mode 100644 index 0000000..b53f02c --- /dev/null +++ b/nodejs-java/rendering-basics/_index.md @@ -0,0 +1,10 @@ +--- +id: rendering-basics +url: viewer/nodejs-java/document-rendering-basics +title: Document rendering basics +weight: 3 +description: "This section describes how to use GroupDocs.Viewer for Node.js to convert different document types to PDF, HTML, PNG, and JPEG formats." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +isMenuItemWithNoContent: True +--- diff --git a/nodejs-java/rendering-basics/render-images.md b/nodejs-java/rendering-basics/render-images.md new file mode 100644 index 0000000..e7ea4ca --- /dev/null +++ b/nodejs-java/rendering-basics/render-images.md @@ -0,0 +1,209 @@ +--- +id: render-images +url: viewer/nodejs-java/render-images +title: Render images as HTML, PDF, PNG, and JPEG files +linkTitle: Render images +weight: 11 +description: "This topic describes how to use the GroupDocs.Viewer Node.js API to convert images to HTML, PDF, PNG, and JPEG formats." +keywords: image viewer, image conversion, image to pdf, image to html, image to png, image to jpeg +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +aliases: + - /viewer/nodejs-java/view-image-files/ + - /viewer/nodejs-java/how-to-convert-and-view-cdr-files + - /viewer/nodejs-java/how-to-convert-and-view-cmx-files + - /viewer/nodejs-java/how-to-convert-and-view-emf-and-emz-files + - /viewer/nodejs-java/how-to-convert-and-view-odg-and-fodg-files + - /viewer/nodejs-java/how-to-convert-and-view-svg-and-svgz-files + - /viewer/nodejs-java/how-to-convert-and-view-wmf-and-wmz-files + - /viewer/nodejs-java/how-to-convert-and-view-psd-with-custom-fonts + - /viewer/nodejs-java/how-to-convert-and-view-ai-files +--- +[GroupDocs.Viewer for Java](https://products.groupdocs.com/viewer/nodejs-java) allows you to load images in various formats and convert them to HTML, PDF, PNG, and JPEG. Incorporate this library into your Java application (web or desktop) to build your own image viewer. + +To start with the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass an image you want to view to the class constructor. You can load the image from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the image to HTML, PDF, PNG, or JPEG format. For multipage images (such as TIFF, CDR, DICOM, WebP, and so on), you can specify the pages to render. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/image" >}} {{< icon "gdoc_person" >}} View image files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported image file formats + +GroupDocs.Viewer supports the following image file formats: + +* [.AI (Adobe Illustrator Artwork)](https://docs.fileformat.com/image/ai/) +* [.APNG (Animated Portable Network Graphic)](https://docs.fileformat.com/image/apng/) +* [.BMP (Bitmap Image)](https://docs.fileformat.com/image/bmp) +* [.CDR (CorelDRAW Image File)](https://docs.fileformat.com/image/cdr) +* [.CGM (Computer Graphics Metafile)](https://docs.fileformat.com/page-description-language/cgm) +* [.CMX (Corel Presentation Exchange Image)](https://docs.fileformat.com/image/cmx) +* [.DCM (DICOM Image)](https://docs.fileformat.com/image/dicom) +* [.DIB (Device Independent Bitmap File)](https://docs.fileformat.com/image/dib) +* [.DJVU (DjVu Image)](https://docs.fileformat.com/image/djvu) +* [.DNG (Digital Negative Image)](https://docs.fileformat.com/image/dng) +* [.EMF (Enhanced Windows Metafile)](https://docs.fileformat.com/image/emf) +* [.EMZ (Windows Compressed Enhanced Metafile)](https://docs.fileformat.com/image/emz/) +* [.EPS (Encapsulated PostScript File)](https://docs.fileformat.com/page-description-language/eps) +* [.FODG (OpenDocument Flat XML Graphics)](https://docs.fileformat.com/image/fodg/) +* [.GIF (Graphical Interchange Format)](https://docs.fileformat.com/image/gif) +* [.ICO (Icon File)](https://docs.fileformat.com/image/ico) +* [.J2C (JPEG 2000 Code Stream)](https://docs.fileformat.com/image/j2c/) +* [.J2K (JPEG 2000 Image)](https://docs.fileformat.com/image/j2k/) +* [.JP2 (JPEG 2000 Core Image File)](https://docs.fileformat.com/image/jp2/) +* [.JPC (JPEG 2000 Code Stream File)](https://docs.fileformat.com/image/jpc/) +* [.JPEG / .JPG (JPEG Image)](https://docs.fileformat.com/image/jpeg) +* [.JPF (JPEG 2000 Image)](https://docs.fileformat.com/image/jpf/) +* [.JPM (JPEG 2000 Multi-layer Image Format)](https://docs.fileformat.com/image/jpm/) +* [.JPX (JPEG 2000 Image File)](https://docs.fileformat.com/image/jpx/) +* [.JLS (JPEG-LS Image)](https://docs.fileformat.com/) +* [.ODG (OpenDocument Graphics File)](https://docs.fileformat.com/image/odg) +* [.OTG (OpenDocument Graphic Template)](https://docs.fileformat.com/image/otg/) +* [.PCL (Printer Command Language Document)](https://docs.fileformat.com/page-description-language/pcl) +* [.PNG (Portable Network Graphics)](https://docs.fileformat.com/image/png) +* [.PS (PostScript File)](https://docs.fileformat.com/page-description-language/ps) +* [.PSB (Photoshop Large Document Format)](https://docs.fileformat.com/image/psb) +* [.PSD (Adobe Photoshop Document)](https://docs.fileformat.com/image/psd) +* [.SVG (Scalable Vector Graphics File)](https://docs.fileformat.com/page-description-language/svg) +* [.SVGZ (Compressed SVG File)](https://docs.fileformat.com/image/svgz/) +* [.TGA (TARGA Graphics)](https://docs.fileformat.com/image/tga/) +* [.TIF / .TIFF (Tagged Image File Format)](https://docs.fileformat.com/image/tiff) +* [.WEBP (WebP Image)](https://docs.fileformat.com/image/webp) +* [.WMF (Windows Metafile)](https://docs.fileformat.com/image/wmf) +* [.WMZ (Compressed Windows Metafile)](https://docs.fileformat.com/image/wmz/) + +## Render images as HTML + +Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To embed an image in an HTML page, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("vector-image.svg") +// Specify the HTML file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("output.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an image to HTML](/viewer/java/images/rendering-basics/render-images/render-image-to-html-embedded-resources.png) + +### Create an HTML file with external resources + +To save an image to a separate folder, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("vector-image.svg") +// Specify the HTML file name and location of external resources. +// {0} is replaced with the resource name in the output file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("output.html", "output/resource_{0}", "output/resource_{0}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The result is shown below. The image is placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/java/images/rendering-basics/render-images/render-image-to-html-external-resources.png) + +## Render images as PDF + +Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +{{< tabs "example3">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("vector-image.svg") +// Create a PDF file. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an image to PDF](/viewer/java/images/rendering-basics/render-images/render-image-to-pdf.png) + +## Convert images to PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("vector-image.svg") +// Create a PNG image. +const viewOptions = new groupdocs.viewer.PngViewOptions("output.png") +// Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an image to PNG](/viewer/java/images/rendering-basics/render-images/render-image-to-png.png) + +## Convert images to JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("vector-image.svg") +// Create a JPG image for the letter. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output.jpg") +// Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render a PSD file with custom fonts + +When you render a PSD file with custom fonts, you can specify a folder that contains necessary fonts to prevent font substitution during rendering. To do this, follow the steps below: + +1. Create a [FolderFontSource](#) class instance and specify a path to the folder that stores custom fonts. Pass a [SearchOption](#) enumeration member to the class constructor to define the search scope. The following options are available: + * `TOP_FOLDER_ONLY`---Searches for the fonts only in the current folder. + * `ALL_FOLDERS`---Searches for the fonts in the current folder and its subfolders. + +2. Call the [FontSettings.setFontSources](#) static method and pass the specified font source to this method as a parameter. This method allows you to specify multiple font sources. + +You can also use the [ViewOptions.setDefaultFontName](#) method to specify the default font that should be used when a particular font is not found. + +{{< tabs "example6">}} +{{< tab "JavaScript" >}} +```js +// Create font sources. +// Add custom fonts folder to look for fonts recursively. (look into subfolders too). +const folderFontSource = new FolderFontSource("C:/custom_fonts_folder", SearchOption.ALL_FOLDERS); +// Add custom fonts folder to look for fonts only in this folder (wihout subfolders). +const additionalFontSource = new FolderFontSource("C:/custom_additional_fonts_folder", SearchOption.TOP_FOLDER_ONLY); +// Call SetFontSources method and supply font sources as arguments. +FontSettings.setFontSources(folderFontSource, additionalFontSource); +const viewer = new groupdocs.viewer.Viewer("sample.psd") + +// Create a JPG image for the letter. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output.jpg") +viewOptions.setDefaultFontName("Arial") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/nodejs-java/rendering-basics/render-pdf-documents.md b/nodejs-java/rendering-basics/render-pdf-documents.md new file mode 100644 index 0000000..22a7b12 --- /dev/null +++ b/nodejs-java/rendering-basics/render-pdf-documents.md @@ -0,0 +1,330 @@ +--- +id: render-pdf-documents +url: viewer/nodejs-java/render-pdf-documents +title: Render PDF documents as HTML and image files +linkTitle: Render PDF documents +weight: 2 +description: "This topic describes how to use the GroupDocs.Viewer Java API to convert PDF files to HTML, PNG, and JPEG formats." +keywords: view pdf, pdf viewer, pdf to html, pdf to jpeg, pdf to jpg, pdf to png, pdf to image, convert pdf +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +aliases: + - /viewer/nodejs-java/how-to-view-pdf-documents-using-nodejs/ +--- +[GroupDocs.Viewer for Node.js](https://products.groupdocs.com/viewer/nodejs-java) allows you to render your PDF files in HTML, PNG, and JPEG formats. Use this library to implement a simple PDF viewer within your Java application (web or desktop). + +Create a [Viewer](#) class instance to get started with the GroupDocs.Viewer API. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to HTML or image format. These methods allow you to render the entire document or specific pages. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/pdf" >}} {{< icon "gdoc_person" >}} View PDF files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported Page Layout file formats + +GroupDocs.Viewer supports the following PDF and Page Layout file formats: + +* [Portable Document Format](https://docs.fileformat.com/pdf/) (.PDF) +* [Microsoft XML Paper Specification](https://docs.fileformat.com/page-description-language/xps/) (.XPS) +* [Open XML Paper Specification](https://docs.fileformat.com/page-description-language/oxps/) (.OXPS) +* [LaTeX Source Document](https://docs.fileformat.com/page-description-language/tex/) (.TEX) + +## Render PDF files as HTML + +Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a PDF file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create an HTML files. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a PDF file to HTML](/viewer/java/images/rendering-basics/render-pdf-documents/render-pdf-to-html.png) + +### Create an HTML file with external resources + +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") + // Create an HTML file for each PDF page. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. External resources are placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/java/images/rendering-basics/render-pdf-documents/render-to-html-external-resources.png) + +### Create HTML with fixed layout + +By default, PDF and EPUB documents are rendered to HTML with fixed layout to ensure that the output HTML looks the same as a source document. Rendering to fixed layout means that all the HTML elements are absolutely positioned to the container element. And container element has a fixed size so browser window resizing will not have an effect on the position and size of elements in a document. + +The following image demonstrates PDF document rendered HTML with fixed layout: + +![Create HTML with fixed layout](/viewer/java/images/rendering-basics/render-pdf-documents/render-pdf-to-html-with-fixed-layout.png) + + +### Adjust image quality in the output HTML file + +The [HtmlviewOptions.getPdfOptions().setImageQuality()](#) methods allows you to specify the quality of images in the output HTML file. You can set this property to one of the following values: + +* [ImageQuality.LOW](#) --- The image resolution is low (96 DPI), and the image size is small. Use this value to increase the conversion performance. +* [ImageQuality.MEDIUM](#) --- The image resolution is medium (192 DPI), and the image size is larger compared to the low quality images. +* [ImageQuality.HIGH](#) --- The image resolution is high (300 DPI), and the image size is big. Use of this value may decrease the conversion performance. + +The following code snippet shows how to set the medium image quality when rendering a PDF document to HTML: + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create an HTML files. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +// Set image quality to medium. +viewOptions.getPdfOptions().setImageQuality(ImageQuality.MEDIUM) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +### Render text as an image + +GroupDocs.Viewer supports the [HtmlViewOptions.getPdfOptions().setRenderTextAsImage](#) option that allows you to render text as an image when you convert a PDF file to HTML. In this case, the layout of the output HTML file closely mirrors the layout of the source PDF document. + +The following code snippet shows how to enable this option in code: + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create an HTML files. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("text-as-image_{0}.html") +// Enable rendering text as image. +viewOptions.getPdfOptions().setRenderTextAsImage(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below illustrates the result. PDF content is exported to HTML as an image, so users cannot select or copy document text. + +![Render PDF content as an image in the output HTML file](/viewer/java/images/rendering-basics/render-pdf-documents/render-pdf-to-html-as-image.png) + +### Enable multi-layer rendering + +When you convert a PDF file to HTML, GroupDocs.Viewer creates an HTML document with a single layer (the `z-index` is not specified for document elements). This helps increase performance and reduce the output file size. If you convert a PDF document with multiple layers and want to improve the position of document elements in the output HTML file, use the [HtmlViewOptions.getPdfOptions().setEnableLayeredRendering](#) method to render text and graphics in the HTML file according to their z-order in the source PDF document. + +The following code snippet shows how to enable the multi-layer rendering: + +{{< tabs "example6">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create an HTML files. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +// Enable the multi-layer rendering. +viewOptions.getPdfOptions().setEnableLayeredRendering(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render PDF files as images + +### Convert PDF files to PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a PDF file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example7">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create a PNG image for each PDF page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a PDF file to PNG](/viewer/java/images/rendering-basics/render-pdf-documents/render-pdf-to-png.png) + +### Convert PDF files to JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a PDF file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example8">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create a JPG image for each PDF page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.jpg") +// Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +### Preserve the size of document pages + +When you render PDF documents as images, GroupDocs.Viewer calculates the optimal image size to achieve better rendering quality. If you want the generated images to be the same size as pages in the source PDF document, use the [PdfOptions.setRenderOriginalPageSize](#) method of the [PngViewOptions](#) or [JpgViewOptions](#) class (depending on the output image format). + +{{< tabs "example9">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create a PNG image for each PDF page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Preserve the size of document pages. +viewOptions.getPdfOptions().setRenderOriginalPageSize(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +### Enable font hinting + +To adjust the display of outline fonts when you convert PDF documents to PNG or JPEG, use the [PdfOptions.setEnableFontHinting](#) method, as shown below: + +{{< tabs "example10">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create a PNG image for each PDF page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Enable font hinting +viewOptions.getPdfOptions().setEnableFontHinting(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +Refer to the following article for more information on font hinting: [Font hinting](https://en.wikipedia.org/wiki/Font_hinting). + +## Disable character grouping + +When you render PDF files in other formats, GroupDocs.Viewer groups individual characters into words to improve rendering performance. If your document contains hieroglyphic or special symbols, you may need to disable character grouping to generate a more precise layout. To do this, use the [PdfOptions.setDisableCharsGrouping](#) method, as shown below: + +{{< tabs "example11">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create a PNG image for each PDF page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Disable character grouping. +viewOptions.getPdfOptions().setDisableCharsGrouping(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render text comments + +Use the [ViewOptions.setRenderComments](#) method for a target view to display textual annotations (such as text comments, sticky notes, text boxes and callouts) in the output HTML, PNG, or JPEG files. + +The code example below renders a PDF file with text comments as an image. + +{{< tabs "example12">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +// Create a PNG image for each PDF page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Enable rendering comments. +viewOptions.setRenderComments(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image illustrates the result: + +![Render PDF comments to PNG](/viewer/java/images/rendering-basics/render-pdf-documents/render-pdf-comments.png) + +## Get information about a PDF file + +Follow the steps below to obtain information about a PDF file (the number of pages, page size, and printing permissions): + +1. Create a [ViewInfoOptions](#) instance for a specific view. +2. Call the [Viewer.getViewInfo](#) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [PdfViewInfo](#) type. +3. Use the `PdfViewInfo` class properties to retrieve document-specific information. + +{{< tabs "example13">}} +{{< tab "JavaScript" >}} +```js +const viewInfoOptions = ViewInfoOptions.forHtmlView(); +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +viewInfo = viewer.getViewInfo(viewInfoOptions) + +// Display information about the PDF document. +console.log("File type: " + viewInfo.getFileType()); +console.log("The number of pages: " + viewInfo.getPages().size()); +console.log("Is printing allowed: " + viewInfo.isPrintingAllowed()); +``` +{{< /tab >}} +{{< /tabs >}} + +The following image shows a sample console output: + +![Get information about a PDF file](/viewer/java/images/rendering-basics/render-pdf-documents/retrieve-pdf-file-information.png) + +### Extract text from a PDF file + +Use the [ViewInfoOptions.setExtractText](#) method to enable PDF text extraction. Use the [PdfViewInfo.getPages](#) methods to obtain the list of all document pages, and use the ([Page.getLines](#) method to retrieve text for each line. + +{{< tabs "example14">}} +{{< tab "JavaScript" >}} +```js +const viewInfoOptions = ViewInfoOptions.forHtmlView(); +viewInfoOptions.setExtractText(true) + +const viewer = new groupdocs.viewer.Viewer("resume.pdf") +viewInfo = viewer.getViewInfo(viewInfoOptions) + +// Retrieve text from the PDF file. +viewInfo.getPages().toArray().forEach(function(page) { + page.getLines().toArray().forEach(function(line){ + console.log(line.getValue()) + }) + }) +``` +{{< /tab >}} +{{< /tabs >}} + +![Extract and display PDF text](/viewer/java/images/rendering-basics/render-pdf-documents/extract-pdf-text.png) diff --git a/nodejs-java/rendering-basics/render-presentations.md b/nodejs-java/rendering-basics/render-presentations.md new file mode 100644 index 0000000..026f6e3 --- /dev/null +++ b/nodejs-java/rendering-basics/render-presentations.md @@ -0,0 +1,235 @@ +--- +id: render-presentations +url: viewer/nodejs-java/render-presentations +title: Render PowerPoint presentations as HTML, PDF, and image files +linkTitle: Render PowerPoint presentations +weight: 4 +description: "This topic describes how to use the GroupDocs.Viewer Node.js API to convert PowerPoint presentations to HTML, PDF, PNG, and JPEG formats." +keywords: convert pptx to pdf, convert pptx to html, convert pptx to jpeg, convert ppt to pdf, convert presentation to pdf, convert ppt to html, convert presentation to html, convert presentation to image +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +aliases: + - /viewer/nodejs-java/view-powerpoint-presentations/ + - /viewer/nodejs-java/how-to-set-resolution-for-images-when-rendering-presentations-to-html/ + - /viewer/nodejs-java/how-to-convert-and-view-fodp-and-odp-files/ + - /viewer/nodejs-java/converting-presentations-with-shapes-and-text-with-3-d-effects/ + - /viewer/nodejs-java/show-document-notes +--- +[GroupDocs.Viewer for Node.js](https://products.groupdocs.com/viewer/nodejs-java) allows you to render your presentations in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft PowerPoint or other software to load and view presentations within your Java application (web or desktop). + +Create a [Viewer](#) class instance to get started with the GroupDocs.Viewer API. Pass a presentation you want to view to the class constructor. You can load the presentation from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the presentation to HTML, PDF, or image format. These methods allow you to render the entire presentation or specific slides. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/powerpoint" >}} {{< icon "gdoc_person" >}} View PowerPoint files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported Presentation file formats + +GroupDocs.Viewer supports the following file formats: + +* {{% closedlink title="Microsoft PowerPoint Presentation" href="https://docs.fileformat.com/presentation/pptx/" %}} (.PPTX) +* {{% closedlink title="Microsoft PowerPoint 97-2003 Presentation" href="https://docs.fileformat.com/presentation/ppt/" %}} (.PPT) +* {{% closedlink title="Microsoft PowerPoint Template" href="https://docs.fileformat.com/presentation/potx" %}} (.POTX) +* {{% closedlink title="Microsoft PowerPoint 97-2003 Template" href="https://docs.fileformat.com/presentation/pot" %}} (.POT) +* {{% closedlink title="Microsoft PowerPoint Macro-Enabled Template" href="https://docs.fileformat.com/presentation/potm" %}} (.POTM) +* {{% closedlink title="Microsoft PowerPoint Slide Show" href="https://docs.fileformat.com/presentation/ppsx" %}} (.PPSX) +* {{% closedlink title="Microsoft PowerPoint Macro-Enabled Slide Show" href="https://docs.fileformat.com/presentation/ppsm" %}} (.PPSM) +* {{% closedlink title="Microsoft PowerPoint 97-2003 Slide Show" href="https://docs.fileformat.com/presentation/pps" %}} (.PPS) +* {{% closedlink title="Microsoft PowerPoint Macro-Enabled Presentation" href="https://docs.fileformat.com/presentation/pptmx" %}} (.PPTM) +* {{% closedlink title="OpenDocument Presentation" href="https://docs.fileformat.com/presentation/odp" %}} (.ODP) +* {{% closedlink title="OpenDocument Presentation Template" href="https://docs.fileformat.com/presentation/otp" %}} (.OTP) +* {{% closedlink title="OpenDocument Flat XML Presentation" href="https://docs.fileformat.com/" %}} (.FODP) + +## Render presentations as HTML + +Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +// Create an HTML file for each slide. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a presentation file to HTML](/viewer/java/images/rendering-basics/render-presentations/render-to-html-embedded-resources.png) + +### Create an HTML file with external resources + +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +// Create an HTML file for each slide. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}"); +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. External resources are placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/java/images/rendering-basics/render-presentations/render-to-html-external-resources.png) + +## Render presentations as PDF + +Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +{{< tabs "example3">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a presentation file to PDF](/viewer/java/images/rendering-basics/render-presentations/render-to-pdf.png) + +## Render presentations as PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +// Create a PNG image for each slide. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a presentation file to PNG](/viewer/java/images/rendering-basics/render-presentations/render-to-png-image.png) + +## Render presentations as JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +// Create a JPG image for each slide. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.jpg") +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Specify image resolution + +When you convert presentations with high-resolution images to other formats, you may need to lower image resolution to reduce the output file size. GroupDocs.Viewer supports the [PresentationOptions.setResolution](#) method that allows you to compress images in the output HTML and PDF files. To access this option, use the [HtmlViewOptions.setPresentationOptions](#) or [PdfViewOptions.setPresentationOptions](#) methods (depending on the output file format). + +You can use the [PresentationOptions.setResolution](#) method to one of the following [Resolution](#) field values: + +| Resolution field | DPI | Remarks | +| --- | --- | --- | +| DOCUMENT_RESOLUTION | As in the source file | This is the default value.| +| DPI_72 | 72 | Maximum image compression and minimum file size. | +| DPI_96 | 96 | Good for web pages and projectors. | +| DPI_150 | 150 | Good for web pages and projectors. | +| DPI_220 | 220 | Excellent quality on most printers and screens. | +| DPI_330 | 330 | Good quality for high-definition (HD) displays. | + +The following example demonstrates how to specify image resolution in code: + +{{< tabs "example6">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewOptions.getPresentationOptions().setResolution(Resolution.Dpi150) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render hidden slides + +If your presentation contains hidden slides, use the [ViewOptions.setRenderHiddenPages](#) method for a target view to display these slides in the output HTML, PDF, or image files. + +The following code example uses this option to display hidden slides in the generated PDF file: + +{{< tabs "example7">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewOptions.setRenderHiddenPages(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render comments + +Use the [ViewOptions.setRenderComments](#) method for a target view to display comments in the output file when you convert your presentation to HTML, PDF, PNG, or JPEG format. + +{{< tabs "example8">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewOptions.setRenderComments(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a presentation with comments](/viewer/java/images/rendering-basics/render-presentations/render-presentation-comments-to-pdf.png) + +## Render speaker notes + +A presentation file can contain speaker notes that help presenters recall important information during the presentation. Speaker notes appear in the **Notes** pane below each slide. + +![Speaker notes in Microsoft PowerPoint](/viewer/java/images/rendering-basics/render-presentations/presentation-speaker-notes.png) + +Use the [ViewOptions.setRenderNotes](#) method for a target view to display speaker notes in the output HTML, PDF, or image files. + +The following code sample renders a presentation with speaker notes to PDF: + +{{< tabs "example9">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.pptx") +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewOptions.setRenderNotes(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. + +![Render a presentation with notes](/viewer/java/images/rendering-basics/render-presentations/render-presentation-notes-to-pdf.png) diff --git a/nodejs-java/rendering-basics/render-spreadsheets/_index.md b/nodejs-java/rendering-basics/render-spreadsheets/_index.md new file mode 100644 index 0000000..bbbf924 --- /dev/null +++ b/nodejs-java/rendering-basics/render-spreadsheets/_index.md @@ -0,0 +1,10 @@ +--- +id: render-spreadsheets +url: viewer/nodejs-java/render-spreadsheets +title: Render spreadsheet files +weight: 3 +description: "This section describes how to use GroupDocs.Viewer for Node.js to convert spreadsheet files to PDF, HTML, PNG, and JPEG formats." +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +isMenuItemWithNoContent: True +--- diff --git a/nodejs-java/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md b/nodejs-java/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md new file mode 100644 index 0000000..dd4725d --- /dev/null +++ b/nodejs-java/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md @@ -0,0 +1,329 @@ +--- +id: render-excel-and-apple-numbers-spreadsheets +url: viewer/nodejs-java/render-excel-and-apple-numbers-spreadsheets +title: Render Excel and Apple Numbers spreadsheets as HTML, PDF, and image files +linkTitle: Render Excel and Apple Numbers spreadsheets +weight: 1 +description: "This topic describes how to use the GroupDocs.Viewer API for Node.js to convert Excel workbooks and Apple Numbers spreadsheets to HTML, PDF, PNG, and JPEG formats." +keywords: excel to pdf, excel to html, excel to jpg, xlsx to pdf, xls to pdf, excel to pdf online, convert xls to pdf, convert xlsx to pdf +productName: GroupDocs.Viewer for Node.js via Java +toc: True +hideChildren: False +aliases: + - /viewer/nodejs-java/view-excel-spreadsheets/ + - /viewer/nodejs-java/how-to-convert-and-view-apple-numbers-files/ + - /viewer/nodejs-java/how-to-convert-and-view-excel-spreadsheetml-files/ + - /viewer/nodejs-java/separator-detection/ + - /viewer/nodejs-java/how-to-get-the-names-of-the-worksheets/ +--- +[GroupDocs.Viewer for Node.js](https://products.groupdocs.com/viewer/nodejs-java) allows you to render your spreadsheet files in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Excel or other spreadsheet programs to load and view Excel documents within your JavaScript application (web or desktop). + +To start with the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a spreadsheet file you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/excel" >}} {{< icon "gdoc_person" >}} View Excel files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported spreadsheet file formats + +GroupDocs.Viewer supports the following spreadsheet file formats: + +* [Microsoft Excel Workbook](https://docs.fileformat.com/spreadsheet/xlsx) (.XLSX) +* [Microsoft Excel 97-2003 Workbook](https://docs.fileformat.com/spreadsheet/xls) (.XLS) +* [Microsoft Excel Binary Workbook](https://docs.fileformat.com/spreadsheet/xlsb) (.XLSB) +* [Microsoft Excel Macro-Enabled Workbook](https://docs.fileformat.com/spreadsheet/xlsm) (.XLSM) +* [Microsoft Excel Template](https://docs.fileformat.com/spreadsheet/xltx) (.XLTX) +* [Microsoft Excel 97-2003 Template](https://docs.fileformat.com/spreadsheet/xlt) (.XLT) +* [Microsoft Excel Macro-Enabled Template](https://docs.fileformat.com/spreadsheet/xltm) (.XLTM) +* [Microsoft Excel Add-In](https://docs.fileformat.com/spreadsheet/xlam/) (.XLAM) +* [XML Spreadsheet 2003](https://en.wikipedia.org/wiki/SpreadsheetML) (.XML) +* [OpenDocument Spreadsheet](https://docs.fileformat.com/spreadsheet/ods) (.ODS) +* [OpenDocument Spreadsheet Template](https://docs.fileformat.com/spreadsheet/ots/) (.OTS) +* [OpenDocument Flat XML Spreadsheet](https://docs.fileformat.com/spreadsheet/fods/) (.FODS) +* [Comma Separated Values File](https://docs.fileformat.com/spreadsheet/csv) (.CSV) +* [Tab Separated Values File](https://docs.fileformat.com/spreadsheet/tsv) (.TSV) +* [StarOffice Calc Spreadsheet](https://docs.fileformat.com/spreadsheet/sxc/) (.SXC) +* [Apple Numbers Spreadsheet](https://docs.fileformat.com/spreadsheet/numbers) (.NUMBERS) + +## Render spreadsheets as HTML + +Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +#### Convert an Excel workbook to HTML + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("invoice.xlsx") +// Convert the spreadsheet to HTML. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an Excel file to HTML](/viewer/java/images/rendering-basics/render-spreadsheets/convert-excel-to-html.png) + +#### Convert an Apple Numbers spreadsheet to HTML + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("Products.numbers") +// Convert the spreadsheet to HTML. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an Apple Numbers spreadsheet to HTML](/viewer/java/images/rendering-basics/render-spreadsheets/render-apple-numbers-to-html.png) + +### Create an HTML file with external resources + +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +#### Convert an Excel workbook to HTML + +{{< tabs "example3">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("invoice.xlsx") +// Convert the spreadsheet to HTML. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +#### Convert an Apple Numbers spreadsheet to HTML + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("Products.numbers") +// Convert the spreadsheet to HTML. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. External resources are placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/java/images/rendering-basics/render-spreadsheets/render-excel-to-html-external-resources.png) + + +### Convert all Excel worksheets to one HTML file + +To convert all worksheets to one HTML file, use the [HtmlViewOptions.setRenderToSinglePage](#) method. This feature is supported in both cases - when converting to HTML with embedded and external resources. + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("Personal_net_worth_calculator.xlsx") +// Convert all Excel worksheets to one HTML file. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page.html") +// Enable converting all worksheets to one file. +viewOptions.setRenderToSinglePage(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Convert all Excel worksheets to one HTML file](/viewer/java/images/rendering-basics/render-spreadsheets/convert-all-excel-worksheets-to-html.png) + + +## Render spreadsheets as PDF + +Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +### Convert an Excel workbook to PDF + +{{< tabs "example6">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("invoice.xlsx") +// Convert the spreadsheet to PDF. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an Excel file to PDF](/viewer/java/images/rendering-basics/render-spreadsheets/render-excel-to-pdf.png) + +### Convert an Apple Numbers spreadsheet to PDF + +{{< tabs "example7">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("Products.numbers") +// Convert the spreadsheet to PDF. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an Apple Numbers spreadsheet to PDF](/viewer/java/images/rendering-basics/render-spreadsheets/render-apple-numbers-to-pdf.png) + +## Render spreadsheets as PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +### Convert an Excel workbook to PNG + +{{< tabs "example8">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("invoice.xlsx") +// Convert the spreadsheet to PNG. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Set width and height. +viewOptions.setWidth(800) +viewOptions.setHeight(900) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} +The following image demonstrates the result: + +![Render an Excel file to PNG](/viewer/java/images/rendering-basics/render-spreadsheets/render-excel-to-png.png) + +### Convert an Apple Numbers spreadsheet to PNG + +{{< tabs "example9">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("Products.numbers") +// Convert the spreadsheet to PNG. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Set width and height. +viewOptions.setWidth(800) +viewOptions.setHeight(900) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render an Apple Numbers spreadsheet to PNG](/viewer/java/images/rendering-basics/render-spreadsheets/render-apple-numbers-to-png.png) + +## Render spreadsheets as JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + +### Convert an Excel workbook to JPEG + +{{< tabs "example10">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("invoice.xlsx") +// Convert the spreadsheet to JPEG. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.jpg") +// Set width and height. +viewOptions.setWidth(800) +viewOptions.setHeight(900) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +### Convert an Apple Numbers spreadsheet to JPEG + +{{< tabs "example11">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("Products.numbers") +// Convert the spreadsheet to JPEG. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.jpg") +// Set width and height. +viewOptions.setWidth(800) +viewOptions.setHeight(900) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Detect a CSV/TSV separator + +If you load a CSV/TSV file to convert it to another format, use the [SpreadsheetOptions.setDetectSeparator](#) method for a target view to automatically detect a delimiter used to separate values in the source file. + +GroupDocs.Viewer can detect the following separators: + +* A comma (the default separator) +* A semicolon + +{{< tabs "example12">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.csv") +// Convert the spreadsheet to JPEG. +// {0} is replaced with the current page number in the file names. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +// Detect a CSV/TSV separator. +viewOptions.getSpreadsheetOptions().setDetectSeparator(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Get worksheet names + +GroupDocs.Viewer allows you to obtain information about the source spreadsheet file. For example, you can retrieve worksheet names, as described below: + +1. Create a [ViewInfoOptions](#) instance for a specific view. +2. Call the [Viewer.getViewInfo](#) method and pass the `ViewInfoOptions` instance to this method as a parameter. +3. Use the [getPages](#) method of the returned [ViewInfo](#) object to access to the list of worksheets and retrieve the worksheet names. + +{{< tabs "example13">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.xlsx") +const viewInfoOptions = ViewInfoOptions.forHtmlView() +// Call this method to create a single page for each worksheet. +viewInfoOptions.setSpreadsheetOptions(SpreadsheetOptions.forOnePagePerSheet()) +const ViewInfo viewInfo = viewer.getViewInfo(viewInfoOptions) +// Print the worksheet names in the console window. +console.log("The document contains the following worksheets:") +console.log(info.toString()) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image shows a sample console output: + +![Retrieve worksheet names](/viewer/java/images/rendering-basics/render-spreadsheets/retrieve-worksheet-names.png) + +## See also + +* [Split a worksheet into pages](/viewer/nodejs-java/split-worksheet-into-pages/) +* [Specify spreadsheet rendering options](/viewer/nodejs-java/specify-rendering-options/) diff --git a/nodejs-java/rendering-basics/render-text-files.md b/nodejs-java/rendering-basics/render-text-files.md new file mode 100644 index 0000000..681f047 --- /dev/null +++ b/nodejs-java/rendering-basics/render-text-files.md @@ -0,0 +1,248 @@ +--- +id: render-text-files +url: viewer/nodejs-java/render-text-files +title: Render text documents as HTML, PDF, and image files +linkTitle: Render text documents +weight: 10 +description: "This topic describes how to use the GroupDocs.Viewer Node.js API to convert text files to HTML, PDF, PNG, and JPEG formats." +keywords: text file conversion, txt to pdf, txt to html, txt to png, txt to jpeg +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +aliases: + - /viewer/nodejs-java/view-text-files + - /viewer/nodejs-java/how-to-convert-and-view-txt-files + - /viewer/nodejs-java/configure-count-of-characters-per-row-and-rows-per-page-to-render +--- +[GroupDocs.Viewer for Node.js](https://products.groupdocs.com/viewer/nodejs-java) allows you to convert text documents to HTML, PDF, PNG, and JPEG formats so you can view document content in a web browser, PDF or image viewer application. + +To start with the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a text document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the image to HTML, PDF, PNG, or JPEG format. These methods allow you to render the entire document or specific pages. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/total" >}} {{< icon "gdoc_person" >}} View text files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported text file formats + +GroupDocs.Viewer supports the following text and programming file formats: + +* [.AS / .AS3 (ActionScript File)](https://docs.fileformat.com/programming/as/) +* [.ASM (Assembly Language Source Code File)](https://docs.fileformat.com/programming/asm/) +* [.BAT (DOS Batch File)](https://docs.fileformat.com/executable/bat/) +* [.C (C/C++ Source Code File)](https://docs.fileformat.com/programming/c/) +* [.CC (C++ Source Code File)](https://docs.fileformat.com/programming/c/) +* [.CMAKE (CMake File)](https://docs.fileformat.com/programming/cmake/) +* [.CPP (C++ Source Code File)](https://docs.fileformat.com/programming/cpp/) +* [.CS (C# Source Code File)](https://docs.fileformat.com/specification/programming/cs/) +* [.CSS (Cascading Style Sheet)](https://docs.fileformat.com/web/css/) +* [.CXX (C++ Source Code File)](https://docs.fileformat.com/programming/cxx/) +* [.DIFF (Patch File)](https://docs.fileformat.com/programming/diff/) +* [.ERB (Ruby ERB Script)](https://docs.fileformat.com/programming/erb/) +* [.GROOVY (Groovy Source Code File)](https://docs.fileformat.com/programming/groovy/) +* [.H (C/C++/Objective-C Header File)](https://docs.fileformat.com/programming/h/) +* [.HAML (Haml Source Code File)](https://docs.fileformat.com/programming/haml/) +* [.HH (C++ Header File)](https://docs.fileformat.com/programming/hh/) +* [.JAVA (Java Source Code File)](https://docs.fileformat.com/programming/nodejs-java/) +* [.JS (JavaScript File)](https://docs.fileformat.com/web/js/) +* [.JSON (JavaScript Object Notation File)](https://docs.fileformat.com/web/json/) +* [.LESS (LESS Style Sheet)](https://docs.fileformat.com/web/less/) +* [.LOG (Log File)](https://docs.fileformat.com/database/log/) +* [.M (Objective-C Implementation File)](https://docs.fileformat.com/programming/m/) +* [.MAKE (Xcode Makefile Script)](https://docs.fileformat.com/programming/make/) +* [.MD (Markdown Documentation File)](https://docs.fileformat.com/word-processing/md/) +* [.ML (ML Source Code File)](https://docs.fileformat.com/programming/ml/) +* [.MM (Objective-C++ Source File)](https://docs.fileformat.com/programming/mm/) +* [.PHP (PHP Source Code File)](https://docs.fileformat.com/programming/php/) +* [.PL (Perl Script)](https://docs.fileformat.com/programming/pl/) +* [.PROPERTIES (Java Properties File)](https://en.wikipedia.org/wiki/.properties) +* [.PY (Python Script)](https://docs.fileformat.com/programming/py/) +* [.RB (Ruby Source Code)](https://docs.fileformat.com/ebook/rb/) +* [.RST (reStructuredText File)](https://docs.fileformat.com/programming/rst/) +* [.SASS (Syntactically Awesome StyleSheets File)](https://docs.fileformat.com/web/sass/) +* [.SCALA (Scala Source Code File)](https://docs.fileformat.com/programming/scala/) +* [.SCM (Scheme Source Code File)](https://docs.fileformat.com/programming/scm/) +* [.SCRIPT (Generic Script File)](https://docs.fileformat.com/programming/script/) +* [.SH (Bash Shell Script)](https://docs.fileformat.com/programming/sh/) +* [.SML (Standard ML Source Code File)](https://en.wikipedia.org/wiki/Standard_ML) +* [.SQL (Structured Query Language Data File)](https://docs.fileformat.com/database/sql/) +* [.TXT (Plain Text File)](https://docs.fileformat.com/word-processing/txt/) +* [.VB (Visual Basic Source Code File)](https://docs.fileformat.com/specification/programming/vb/) +* [.VIM (Vim Settings File)](https://docs.fileformat.com/misc/vim/) +* [.XML (XML File)](https://docs.fileformat.com/web/xml/) +* [.YAML (YAML Document)](https://docs.fileformat.com/programming/yaml/) + +When you load a text document from a file, you should explicitly specify their format. To do this, create a [LoadOptions](#) class instance and use the [FileType](#) method. Then pass this instance to the [Viewer](#) class constructor. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +// Specify the file encoding. +const loadOptions = new LoadOptions(FileType.MD) +// Convert the document to PDF. +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt", loadOptions) +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render text files as HTML + +Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create HTML files with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +{{< tabs "example3">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") +// Convert the text file to HTML. +// {0} is replaced with the current page number in the output file names. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a text file to HTML](/viewer/java/images/rendering-basics/render-text-files/render-to-html-embedded-resources.png) + +### Create HTML files with external resources + +If you want to store output HTML files and additional resource files (such as fonts, images, and style sheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") +// Create an HTML file for each PDF page. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. External resources are placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/java/images/rendering-basics/render-text-files/render-to-html-external-resources.png) + +### Create a single HTML page + +If you need to display the entire document content on a single HTML page, use the [HtmlViewOptions.setRenderToSinglePage](#) method, as shown below: + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") +// Create an HTML file. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("output.html") +// Render the file to a single page. +viewOptions.setRenderToSinglePage(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render text files as PDF + +Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +{{< tabs "example6">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") +// Convert the text file to PDF. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a text file to PDF](/viewer/java/images/rendering-basics/render-text-files/render-to-pdf.png) + +## Render text files as PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example7">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") +// Convert the text file to PNG. +// {0} is replaced with the current page number in the output image names. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +// Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a text file to PNG](/viewer/java/images/rendering-basics/render-text-files/render-to-png-image.png) + +## Render text files as JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example8">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") +// Convert the text file to JPEG. +// {0} is replaced with the current page number in the output image names. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.jpg") +// Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(550) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Specify rendering options + +GroupDocs.Viewer supports the [TextOptions](#) class that allows you to specify different options for rendering text files. To access these options, use the [setTextOptions](#) method for one of the following classes (depending on the output file format): + +* [HtmlViewOptions](#) +* [PdfViewOptions](#) +* [PngViewOptions](#) +* [JpgViewOptions](#) + +The `TextOptions` class supports the following methods: + +* [setMaxRowsPerPage](#)---Specifies the maximum number of rows per page. The default value is **55**. + +* [setMaxCharsPerRow](#)---Specifies the maximum number of characters per row. The default value is **85**. + +The following example demonstrates how to change the number of rows displayed on each HTML page: + +{{< tabs "example9">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("TermsOfService.txt") + // Convert the text file to HTML. +// {0} is replaced with the current page number in the output file names. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +// Set the maximum number of rows per page. +viewOptions.getTextOptions().setMaxRowsPerPage(30) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below illustrates the result: + +![Specify the number of rows per page](/viewer/java/images/rendering-basics/render-text-files/set-max-rows-per-page.png) + \ No newline at end of file diff --git a/nodejs-java/rendering-basics/render-web-documents.md b/nodejs-java/rendering-basics/render-web-documents.md new file mode 100644 index 0000000..2e27677 --- /dev/null +++ b/nodejs-java/rendering-basics/render-web-documents.md @@ -0,0 +1,138 @@ +--- +id: render-web-documents +url: viewer/nodejs-java/render-web-documents +title: Render web documents as PDF, PNG, and JPEG files +linkTitle: Render web documents +weight: 9 +description: "This topic describes how to use the GroupDocs.Viewer Node.js API to convert web documents to PDF, PNG, and JPEG formats." +keywords: convert html, html to pdf, html to jpeg, html to png, html to image +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +aliases: + - /viewer/nodejs-java/view-web-documents + - /viewer/nodejs-java/how-to-convert-and-view-chm-files + - /viewer/nodejs-java/how-to-convert-and-view-html-files-with-margins +--- +[GroupDocs.Viewer for Node.js](https://products.groupdocs.com/viewer/nodejs-java) allows you to render web documents as PDF, PNG, and JPEG files. Use this library to view web files within your Java application. + +To start using the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a web document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to PDF or image format. These methods allow you to render the entire document or specific pages. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/web" >}} {{< icon "gdoc_person" >}} View web files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported web file formats + +GroupDocs.Viewer supports the following web file formats: + +* [Hypertext Markup Language Format](https://docs.fileformat.com/web/html/) (.HTML / .HTM) +* [MIME HTML Format](https://docs.fileformat.com/web/mhtml/) (.MHTML) +* [MHTML Web Archive](https://docs.fileformat.com/web/mht/) (.MHT) +* [Compiled HTML Help Format](https://docs.fileformat.com/web/chm/) (.CHM) + +## Render web documents as PDF + +Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a web file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("groupdocs-documentation.mhtml") + // Create a PDF file for the document. +// Specify the PDF file name. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a web file to PDF](/viewer/java/images/rendering-basics/render-web-documents/render-web-to-pdf.png) + +## Render web documents as PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a web file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("groupdocs-documentation.mhtml") +// Convert the web file to PNG. +// {0} is replaced with the page numbers in the output image names. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") + // Set width and height. +viewOptions.setWidth(950) +viewOptions.setHeight(800) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a web file to PNG](/viewer/java/images/rendering-basics/render-web-documents/render-web-to-png.png) + +## Render web documents as JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a web file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example3">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("groupdocs-documentation.mhtml") +// Create a JPEG image for each drawing page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.jpg") + // Set width and height. +viewOptions.setWidth(1600) +viewOptions.setHeight(650) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Convert CHM files to HTML + +[CHM](https://docs.fileformat.com/web/chm/) is a Microsoft proprietary online help format that is often used for software documentation. With GroupDocs.Viewer, you can convert a CHM file to HTML to display this file in a web browser. To do this, create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.chm") +// Convert the CHM file to HTML. +// {0} is replaced with the page numbers in the output file names. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("chm_result_{0}.html") +// Enable the following option to display all CHM content on a single HTML page. +// viewOptions.setRenderToSinglePage(true); +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a web file to HTML](/viewer/java/images/rendering-basics/render-web-documents/render-chm-to-html.png) + +### Create an HTML file with external resources + +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("sample.chm") +// Convert the CHM file to HTML. +// Specify the output file names and location of external resources. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}"); +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} \ No newline at end of file diff --git a/nodejs-java/rendering-basics/render-word-documents.md b/nodejs-java/rendering-basics/render-word-documents.md new file mode 100644 index 0000000..a44415e --- /dev/null +++ b/nodejs-java/rendering-basics/render-word-documents.md @@ -0,0 +1,225 @@ +--- +id: render-word-documents +url: viewer/nodejs-java/render-word-documents +title: Render Word documents as HTML, PDF, and image files +linkTitle: Render Word documents +weight: 1 +description: "This topic describes how to use the GroupDocs.Viewer and Node.js to convert Word documents to HTML, PDF, PNG, and JPEG formats." +keywords: convert word to pdf, convert word to jpeg, convert doc to pdf, convert docx to pdf, convert word to jpg, convert word to jpeg +productName: GroupDocs.Viewer for Node.js via Java +hideChildren: False +toc: True +aliases: + - /viewer/nodejs-java/how-to-view-word-documents-using-csharp/ + - /viewer/nodejs-java/show-document-comments +--- +[GroupDocs.Viewer for Node.js](https://products.groupdocs.com/viewer/nodejs-java) allows you to render your Microsoft Word documents in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Word or other word processors to load and view Word documents within your JavaScript application (web or desktop). + +To start using the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/word" >}} {{< icon "gdoc_person" >}} View Word files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Node.js-via-Java" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported Word Processing file formats + +GroupDocs.Viewer supports the following Word Processing file formats: + +* [Microsoft Word Document](https://docs.fileformat.com/word-processing/docx) (.DOCX) +* [Microsoft Word 97-2003 Document](https://docs.fileformat.com/word-processing/doc) (.DOC) +* [Microsoft Word Macro-Enabled Document](https://docs.fileformat.com/word-processing/docm) (.DOCM) +* [Microsoft Word 97-2003 Template](https://docs.fileformat.com/word-processing/dot) (.DOT) +* [Microsoft Word Macro-Enabled Template](https://docs.fileformat.com/word-processing/dotm) (.DOTM) +* [Microsoft Word Template](https://docs.fileformat.com/word-processing/dotx) (.DOTX) +* [OpenDocument Text](https://docs.fileformat.com/word-processing/odt) (.ODT) +* [OpenDocument Text Template](https://docs.fileformat.com/word-processing/ott) (.OTT) +* [Rich Text Document](https://docs.fileformat.com/word-processing/rtf) (.RTF) +* [Plain Text Document](https://docs.fileformat.com/word-processing/txt) (.TXT) + +## Render Word documents as HTML + +Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/nodejs-java/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. + +{{< tabs "example1">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Create an HTML files. +// {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a Word file to HTML](/viewer/java/images/rendering-basics/render-word-documents/render-to-html-embedded-resources.png) + +### Create an HTML file with external resources + +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example2">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Create an HTML file for each page. +// Specify the HTML file names and location of external resources. +// {0} and {1} are replaced with the current page number and resource name, respectively. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forExternalResources("page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. External resources are placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/java/images/rendering-basics/render-word-documents/render-to-html-external-resources.png) + +## Render Word documents as PDF + +Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/java/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +{{< tabs "example3">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Create a PDF file for the document. +// Specify the PDF file name. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a Word file to PDF](/viewer/java/images/rendering-basics/render-word-documents/render-to-pdf.png) + +## Render Word documents as PNG + +Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example4">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Create a PNG image for each document page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.PngViewOptions("output_{0}.png") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} +The following image demonstrates the result: + +![Render a Word file to PNG](/viewer/java/images/rendering-basics/render-word-documents/render-to-png-image.png) + +## Render Word documents as JPEG + +Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. + +{{< tabs "example5">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Create a JPG image for each document page. +// {0} is replaced with the current page number in the image name. +const viewOptions = new groupdocs.viewer.JpgViewOptions("output_{0}.png") +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Define page margins + +Use the following methods to specify the size of page margins in the output files when you convert your Word documents to HTML, PDF, and image formats: + +* [WordProcessingOptions.setTopMargin](#) specifies the distance (in points) between document content and the top edge of the page. +* [WordProcessingOptions.setBottomMargin](#) specifies the distance (in points) between document content and the bottom edge of the page. +* [WordProcessingOptions.setLeftMargin](#) specifies the distance (in points) between document content and the left edge of the page. +* [WordProcessingOptions.setRightMargin](#) specifies the distance (in points) between document content and the right edge of the page. + +You can access these methods for the following classes: + +* [HtmlViewOptions](#) +* [PdfViewOptions](#) +* [PngViewOptions](#) +* [JpgViewOptions](#) + +The example below converts a Word document to HTML and specifies page margins for the output file. + +{{< tabs "example6">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Create an HTML file for each document page. + // {0} is replaced with the current page number in the file name. +const viewOptions = new groupdocs.viewer.HtmlViewOptions.forEmbeddedResources("page_{0}.html") +// Specify the size of page margins in points. +viewOptions.getWordProcessingOptions().setTopMargin(72) +viewOptions.getWordProcessingOptions().setBottomMargin(72) +viewOptions.getWordProcessingOptions().setLeftMargin(54) +viewOptions.getWordProcessingOptions().setRightMargin(54) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Render tracked changes + +GroupDocs.Viewer does not render tracked changes (revisions made to a Word document) by default. If you want to display tracked changes in the output file, use the [WordProcessingOptions.setRenderTrackedChanges](#) method for one of the following classes (depending on the output file format): + +* [HtmlViewOptions](#) +* [PdfViewOptions](#) +* [PngViewOptions](#) +* [JpgViewOptions](#) + +The following code example demonstrates how to render a Word document with tracked changes: + +{{< tabs "example7">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Convert the document to PDF. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +// Enable tracked changes rendering. +viewOptions.getWordProcessingOptions().setRenderTrackedChanges(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image illustrates the result: + +![Render tracked changes to PDF](/viewer/java/images/rendering-basics/render-word-documents/render-track-changes-to-pdf.png) + +## Render comments + +Use the [ViewOptions.setRenderComments](#) method for a target view to display comments in the output file when you convert your document to HTML, PDF, PNG, or JPEG format. + +The code example below renders a Word document with comments to PDF. + +{{< tabs "example8">}} +{{< tab "JavaScript" >}} +```js +const viewer = new groupdocs.viewer.Viewer("resume.docx") +// Convert the document to PDF. +const viewOptions = new groupdocs.viewer.PdfViewOptions("output.pdf") +// Enable rendering comments. +viewOptions.setRenderComments(true) +viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image illustrates the result: + +![Render comments to PDF](/viewer/java/images/rendering-basics/render-word-documents/render-comments-to-pdf.png) diff --git a/nodejs-java/technical-support.md b/nodejs-java/technical-support.md new file mode 100644 index 0000000..76792c9 --- /dev/null +++ b/nodejs-java/technical-support.md @@ -0,0 +1,40 @@ +--- +id: technical-support +url: /viewer/nodejs-java/technical-support +title: Technical Support +description: "GroupDocs.Viewer for Node.js provides free technical support available to all users. Please report your question, issue, or feature request using GroupDocs Free Support Forum." +productName: GroupDocs.Viewer for Node.js via Java +weight: 7 +toc: True +--- + +GroupDocs provides unlimited free technical support for all of its products. Support is available to all users, including evaluation. The support is provided at [Free Support Forum](https://forum.groupdocs.com/) and [Paid Support Helpdesk](https://helpdesk.groupdocs.com/). + +{{< alert style="info" >}} + +Please note that GroupDocs does not provide technical support over the phone. Phone support is only available for sales and purchase questions. + +{{< /alert >}} + +## GroupDocs Free Support Forum + +If you need help with GroupDocs.Viewer, consider the following: + +* Make sure you are using the latest GroupDocs.Viewer version before reporting an issue. See [NPM](https://www.npmjs.com/package/@groupdocs/groupdocs.viewer) to find out about the latest version. +* Have a look through the forums, this documentation, and the API Reference before reporting an issue – perhaps your question has already been answered. +* Post your question at [GroupDocs.Viewer Free Support Forum](https://forum.groupdocs.com/c/viewer/9), and we'll assist you. Questions are answered directly by the GroupDocs.Viewer development team. +* When expecting a reply on the forums, please allow for time zone differences. + +## Paid Support Helpdesk + +The paid support issues has higher priority comparing to the free support requests. + +* Post your question at the [Paid Support Helpdesk](https://helpdesk.groupdocs.com/) to set higher priority for the issue. + +## Report an Issue or Feature Request + +When posting your issue, question, or feature request with GroupDocs.Viewer, follow these simple steps to make sure it is resolved in the most efficient way: + +* Include the original document and possibly the code snippet that is causing the problem. If you need to attach a few files, zip them into one. It is safe to attach your documents to GroupDocs.Forums because only you and the GroupDocs developers will have access to the attached files. +* Add information about the environment you are facing the issue. +* Try to report one issue per thread. If you have another issue, question, or feature request, please report it in a separate thread.