Skip to content

Commit

Permalink
Node js+licensing (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel-A-Sokolov committed Oct 17, 2023
1 parent b3a4cb7 commit 1a6924a
Show file tree
Hide file tree
Showing 398 changed files with 453 additions and 335 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
id: how-to-change-max-file-size
url: viewer/java/how-to-change-max-file-size
title: How to change the maximum size of a file
weight: 6
description: "This article shows how to change the maximum size of a file."
keywords: "file, size, signed, limit"
productName: GroupDocs.Viewer for Java
hideChildren: False
toc: True
---
Due to the numerous resources and `.class` files in the JAR file, the `MANIFEST.MF` file has become huge. For instance, it is approximately 19.7 Mb for GroupDocs.Viewer v21.2 and 22.5 Mb for GroupDocs.Viewer v23.7.

That is why you may get errors similar to the one below:

```sh
error: error reading /home/jenkins/.gradle/caches/modules-2/files-2.1/com.groupdocs/groupdocs-viewer/21.2/541f695e50f5ed475786402ce0be5978db3a8bb2/groupdocs-viewer-21.2.jar; Unsupported size: 19732345 for JarEntry META-INF/MANIFEST.MF. Allowed max size: 8000000 bytes
```

The issue arises from Java's file size limit, which is set at 8,000,000 bytes by default. You can resolve this using the `-Djdk.jar.maxSignatureFileSize=8000000` option in your Virtual Machine settings. Change the `8,000,000` to the required file size limit.


{{< tabs "example1">}}
{{< tab "Windows" >}}
```sh
SET MAVEN_OPTS="-Djdk.jar.maxSignatureFileSize=25000000"
mvn clean compile spring-boot:run
```
{{< /tab >}}
{{< tab "Linux" >}}
```sh
export MAVEN_OPTS="-Djdk.jar.maxSignatureFileSize=25000000"
mvn clean compile spring-boot:run
```
{{< /tab >}}
{{< /tabs >}}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ The solution is actually very simple as detailed below.

Alternatively, you can add the dependency in the pom.xml and let the project resolve the dependency via maven.

{{< tabs "example1">}}
{{< tab "XML" >}}
```xml
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
```
{{< /tab >}}
{{< /tabs >}}
2 changes: 0 additions & 2 deletions java/product-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ With its powerful and straightforward API, you can execute the following actions
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 Java
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
id: loading-external-resources
url: viewer/net/loading-external-resources
title: Loading of external resources containing by a document
weight: 5
keywords: set timeout, Groupdocs.Viewer
description: "This article explains how to manage loading of external resources contained by a document with GroupDocs.Viewer within your .NET applications."
productName: GroupDocs.Viewer for .NET
hideChildren: False
---

If the document contains external resources, such as images, GroupDocs.Viewer loads them when rendering a document. This allows the document to display correctly, but is a potential security risk.

GroupDocs.Viewer allows you to manage loading of external resources contained by a document. These features are supported for the following formats:
- [Word Processing File Formats](https://docs.fileformat.com/word-processing/)
- [Web File Formats](https://docs.fileformat.com/web/)
- [SpreadSheet File Formats](https://docs.fileformat.com/spreadsheet/)

Use the [LoadOptions](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/loadoptions) object to manage loading of external resources.

## Skip loading of external resources

The following code snippet shows how to deny loading of external resources:

{{< tabs "example3">}}
{{< tab "C#" >}}
```csharp
LoadOptions loadOptions = new LoadOptions();
loadOptions.SkipExternalResources = true; // Skip loading of external resources
using (Viewer viewer = new Viewer("business-flyer.docx", loadOptions))
{
HtmlViewOptions viewOptions =
HtmlViewOptions.ForEmbeddedResources();

viewer.View(viewOptions);
}
```
{{< /tab >}}
{{< /tabs >}}

The following images show the output file with and without external resources (see top right corner):

| loadOptions.SkipExternalResources = false | loadOptions.SkipExternalResources = true |
| --- | --- |
| ![False](/viewer/net/images/with-external-resources.png) | ![True](/viewer/net/images/without-external-resources.png) |

## Manage a safelist for loading external resources

The following code snippet shows how to allow loading of external resources from specific URLs:

{{< tabs "example2">}}
{{< tab "C#" >}}
```csharp
LoadOptions loadOptions = new LoadOptions();
loadOptions.SkipExternalResources = true; // Skip loading of all external resources
loadOptions.WhitelistedResources.Add("avatars.githubusercontent.com"); //Enable loading of external resources that has `avatars.githubusercontent.com` fragment in resource URL.
using (Viewer viewer = new Viewer("business-flyer.docx", loadOptions))
{
HtmlViewOptions viewOptions =
HtmlViewOptions.ForEmbeddedResources();

viewer.View(viewOptions);
}
```
{{< /tab >}}
{{< /tabs >}}

## Set timeout for loading of external resources

The default timeout is 30 seconds. GroupDocs.Viewer allows you to change this value.

The following code snippet shows how to set a timeout to load external resources:

{{< tabs "example1">}}
{{< tab "C#" >}}
```csharp
// Specify a timeout.
LoadOptions loadOptions = new LoadOptions();
loadOptions.ResourceLoadingTimeout = TimeSpan.FromSeconds(5);
// Render a file.
using (Viewer viewer = new Viewer("sample.docx", loadOptions))
{
HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
viewer.View(viewOptions);
}
```
{{< /tab >}}
{{< /tabs >}}

This file was deleted.

55 changes: 27 additions & 28 deletions net/getting-started/licensing-and-subscription.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
---
id: licensing-and-subscription
url: viewer/net/licensing-and-subscription
title: Licensing
title: Licensing and evaluation
weight: 5
keywords: free, free trial, evaluation, groupdocs.viewer
description: "GroupDocs.Viewer provides different plans for purchasing or offers a Free Trial and a 30-day Temporary License for evaluation."
productName: GroupDocs.Viewer for .NET
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.
To study the system, you may want quick access to the API. To make this easier, GroupDocs.Viewer provides different plans for purchase and 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" >}}
Expand All @@ -55,9 +38,9 @@ The license can be set multiple times per app domain but we recommend doing it o

{{< /alert >}}

### Set License from File
### Set a license from a file

The following code sets a license from file.
The following code snippet shows how to set a license from file:

{{< tabs "example1">}}
{{< tab "C#" >}}
Expand All @@ -71,9 +54,9 @@ license.SetLicense(licensePath);
{{< /tab >}}
{{< /tabs >}}

### Set License from Stream
### Set a license from a stream

The following example shows how to set a license from a stream.
The following code snippet shows how to set a license from a stream.

{{< tabs "example2">}}
{{< tab "C#" >}}
Expand All @@ -90,15 +73,14 @@ using (FileStream fileStream = File.OpenRead(licensePath))
{{< /tab >}}
{{< /tabs >}}

### Set Metered License
### Set the metered license

You can also set [Metered](https://reference.groupdocs.com/net/viewer/groupdocs.viewer/metered) license as an alternative to license file. It is a new licensing mechanism that will be used along with existing licensing method. It is useful for the customers who want to be billed based on the usage of the API features. For more details, please refer to [Metered Licensing FAQ](https://purchase.groupdocs.com/faqs/licensing/metered) section.

Following is the sample code demonstrating how to use `Metered` licensing.
The following code snippet shows how to use the metered license.

{{< tabs "example3">}}
{{< tab "C#" >}}

```csharp
string publicKey = ""; // Your public license key
string privateKey = ""; // Your private license key
Expand All @@ -114,6 +96,23 @@ Console.WriteLine("Amount (MB) consumed: " + amountConsumed);
decimal creditsConsumed = GroupDocs.Viewer.Metered.GetConsumptionCredit();
Console.WriteLine("Credits consumed: " + creditsConsumed);
```

{{< /tab >}}
{{< /tabs >}}
{{< /tabs >}}

## How to evaluate GroupDocs.Viewer

You can also try GroupDocs.Viewer without buying a license.

### Free trial

The evaluation version is identical to the purchased one; it becomes licensed once you set the license. You can set the license using methods described in the following sections of this article.

The evaluation version has the following limitations:

- Rendering is limited to the first 2 pages.
- Trial badges are added to the top of each rendered page.

### Temporary license

If you want to test GroupDocs.Viewer without the limitations of the trial version, request a 30-day Temporary License. For details, see the ["Get a Temporary License"](https://purchase.groupdocs.com/temporary-license) page.

4 changes: 0 additions & 4 deletions net/getting-started/system-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ GroupDocs.Viewer for .NET supports .NET as follows:
* .NET Framework 4.5.2 (out of support since v23.8)
* .NET Framework 4.6.0 (out of support since v23.8)
* .NET Framework 4.6.2
* .NET Framework 4.5.0
* .NET Framework 4.5.1
* .NET Framework 4.6.0
* .NET Framework 4.6.2
* .NET Framework 4.7
* .NET Framework 4.7.2
* .NET Framework 4.8
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added net/images/with-external-resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added net/images/without-external-resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,41 @@ using (var viewer = new Viewer("Products.xlsx"))

The image below illustrates the result. The output PDF file contains one page that displays all worksheet data.

![Fit sheet on one page](/viewer/net/images/rendering-basics/render-spreadsheets/render-on-one-page.png)
![Fit sheet on one page](/viewer/net/images/rendering-basics/render-spreadsheets/render-on-one-page.png)

## Render worksheet by page breaks and print area

GroupDocs.Viewer uses page breaks to split a worksheet into separate pages. Microsoft Excel adds automatic page breaks based on paper size and page settings, but you can also insert manual horizontal and vertical page breaks. Switch to **Page Break Preview** in Microsoft Excel to see where page breaks appear on a worksheet.

Also, you can designate one or more cell ranges in a worksheet as the only region to print (a _print area_). A worksheet can contain multiple print areas. Each print area prints on its own page.

When printing, Microsoft Excel splits a worksheet into pages using both page breaks and print areas. In the following image the red line shows the print area, and the blue line shows page breaks:

![Specify page breaks and a print area in Microsoft Excel](/viewer/net/images/rendering-basics/render-spreadsheets/page-breake-vs-print-area.png)

GroupDocs.Viewer also supports this option. Call the [SpreadsheetOptions.ForRenderingPrintAreaAndPageBreaks](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/spreadsheetoptions/methods/forrenderingprintareaandpagebreaks) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.SpreadsheetOptions](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/baseviewoptions/properties/spreadsheetoptions) property to display only the worksheet's print area in the output HTML, PDF, or image file.

The following example renders the Microsoft Excel spreadsheet using page breaks and print areas displayed in the image above to PDF:

{{< tabs "example4">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...
//render spreadsheet to PDF
using (var viewer = new Viewer("products.xlsx"))
{
var viewOptions = new PdfViewOptions("output.pdf");
viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForRenderingPrintAreaAndPageBreaks();
viewer.View(viewOptions);
}
```
{{< /tab >}}
{{< /tabs >}}

The image below illustrates the result:

![Render page breaks and a print area to PDF](/viewer/net/images/rendering-basics/render-spreadsheets/pdf-result.png)

4 changes: 2 additions & 2 deletions nodejs-java/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ GroupDocs.Viewer ships with a wide range of options that allow you to control th

<p>API REFERENCE</p>
<ul>
<li><a href="https://reference.groupdocs.com/viewer/nodejs-java/">GroupDocs.Viewer for Java API Reference</a></li>
<li><a href="https://reference.groupdocs.com/viewer/nodejs-java/">GroupDocs.Viewer for Node.js via Java API Reference</a></li>
</ul>

<--->
Expand All @@ -86,7 +86,7 @@ GroupDocs.Viewer ships with a wide range of options that allow you to control th

<p>VERSION HISTORY</p>
<ul>
<li><a href='https://releases.groupdocs.com/viewer/nodejs-java/release-notes/'>GroupDocs.Viewer for Java Release Notes</a></li>
<li><a href='https://releases.groupdocs.com/viewer/nodejs-java/release-notes/'>GroupDocs.Viewer for Node.js via Java Release Notes</a></li>
</ul>

<p>TECHNICAL SUPPORT</p>
Expand Down
2 changes: 1 addition & 1 deletion nodejs-java/developer-guide/caching-results/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ console.log("Time taken on second call to View method " + currentTimeMillis + "

The following image shows a sample console output:

![](/viewer/java/images/caching-results.png)
![](/viewer/nodejs-java/images/caching-results.png)

For details, please refer to the following pages:
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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"
description: "Processing email attachments, embedded files, and compressed files with GroupDocs.Viewer for Node.js via Java"
keywords: email attachments, embedded files, compressed files
productName: GroupDocs.Viewer for Node.js via Java
hideChildren: False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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
productName: GroupDocs.Viewer for Node.js via Java
hideChildren: False
---
To get and save attachments, follow these steps:
Expand Down
Loading

0 comments on commit 1a6924a

Please sign in to comment.