Skip to content

Commit

Permalink
Documentation articles for v23.6 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-litvinchik committed Jun 24, 2023
1 parent 05e3c54 commit 7f7b031
Show file tree
Hide file tree
Showing 14 changed files with 455 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
id: optimization-pdf-options
url: viewer/net/optimization-pdf-options
title: Optimize the output PDF file
linkTitle: Optimize the output PDF file
weight: 6
description: "This topic describes how to optimize PDF file in the GroupDocs.Viewer .NET API (C#) for web browser or to reduce size."
keywords: convert to pdf, optimize size, optimize browser, optimize web, pdf reduce size
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
GroupDocs.Viewer allows you to optimize the output PDF file for a web browser or to reduce the file size by optimizing resources.

Optimization for a web allows a browser to display the first pages of a PDF file when you open the document, instead of waiting for the entire file to download.

Resource optimization allows you to reduce the size of the output PDF file. While optimizing, GroupDocs.Viewer may reduce the image size or quality, remove notes or form fields, remove objects, fonts, or personal information from a document, and so on.

You can also optimize an existing PDF file. To do this, open it, specify the optimization parameters, and save the output file.


Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: optimization-pdf-for-web
url: viewer/net/optimization-pdf-for-web
title: Optimize a PDF file for a browser
linkTitle: Optimize a PDF file for a browser
weight: 1
description: "This topic describes how to optimize PDF file using the GroupDocs.Viewer .NET API (C#) for web browser or to reduce size."
keywords: convert to pdf, optimize browser, optimize web
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
This optimization allows a browser to display the first pages of a PDF file when you open the document, instead of waiting for the entire file to download.

The following code snippet shows how to optimize a PDF file for browser:
{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
{
Lineriaze = true
};

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


Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
id: optimization-pdf-resources
url: viewer/net/optimization-pdf-resources
title: Optimize the PDF file resources
linkTitle: Optimize the PDF file resources
weight: 2
description: "This topic describes how to optimize PDF file using the GroupDocs.Viewer .NET API (C#) to reduce size."
keywords: convert to pdf, optimize size, pdf reduce size
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
Resource optimization allows you to reduce the size of the output PDF file. While optimizing, GroupDocs.Viewer may reduce the image size or quality, remove notes or form fields, remove objects, fonts, or personal information from a document, and so on.

The following code snippet shows how to optimize the PDF file by default:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions();

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


Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
id: optimization-pdf-spreadsheets
url: viewer/net/optimization-pdf-spreadsheets
title: Optimize spreadsheets in a PDF file
linkTitle: Optimize spreadsheets in a PDF file
weight: 3
description: "This topic describes how to optimize spreadsheets in a PDF file using the GroupDocs.Viewer .NET API (C#)."
keywords: convert to pdf, optimize browser, optimize web
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
This optimization allows to reduce the output file size by setting up border lines. Besides that, it removes the Arial and Times New Roman characters of 32-127 codes.

The default value is `false`.


The following code snippet shows how to optimize spreadsheets in a PDF file:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("invoice.xlsx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions
{
OptimizeSpreadsheets = true
};

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


Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
id: optimize-content
url: viewer/net/optimize-content
title: Optimize content
weight: 5
description: "Optimize content of a PDF file using GroupDocs.Viewer for .NET (C#)"
productName: GroupDocs.Viewer for .NET
hideChildren: False
isMenuItemWithNoContent: True
---

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
id: optimization-pdf-remove-annotations
url: viewer/net/optimization-pdf-remove-annotations
title: Remove annotations
linkTitle: Remove annotations
weight: 1
description: "This topic describes how to remove annotations from PDF file using the GroupDocs.Viewer .NET API (C#)."
keywords: convert to pdf, optimize size, pdf reduce size, remove annotations
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
If the output PDF file contains annotations, you can remove them to reduce the file size.

To remove annotations, set the `RemoveAnnotations` property to `true`.

The following code snippet shows how to remove annotations from the file:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
{
RemoveAnnotations = true
};

viewer.View(viewOptions);
}
```
{{</ tab >}}
{{</ tabs >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
id: optimization-pdf-remove-fields
url: viewer/net/optimization-pdf-remove-fields
title: Remove form fields
linkTitle: Remove form fields
weight: 2
description: "This topic describes how to remove form fields from PDF file using the GroupDocs.Viewer .NET API (C#)."
keywords: convert to pdf, optimize size, pdf reduce size, remove fields
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
If the output PDF file contains form fields, you can flatten them to reduce the file size.

To remove form fields, set the `RemoveFormFields` property to `true`.

The following code snippet shows how to flatten form fields in the file:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
{
RemoveFormFields = true
};

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
id: optimize-fonts
url: viewer/net/optimize-fonts
title: Optimize fonts
weight: 6
description: "Optimize fonts in a PDF file using GroupDocs.Viewer for .NET (C#)"
productName: GroupDocs.Viewer for .NET
hideChildren: False
isMenuItemWithNoContent: True
---

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
id: optimization-pdf-subset-fonts
url: viewer/net/optimization-pdf-subset-fonts
title: Subset fonts
linkTitle: Subset fonts
weight: 2
description: "This topic describes how to subset fonts in PDF file using the GroupDocs.Viewer .NET API (C#)."
keywords: convert to pdf, optimize size, pdf reduce size, subset fonts
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
Optimization resources. SubsetFonts optimization option
Fonts will be converted into subsets if set to true

If the file uses embedded fonts, it contains all font data. GroupDocs.Viewer can subset embedded fonts to reduce the file size.

To subset fonts in a PDF file, set the `SubsetFonts` property to `true`.

The following code snippet shows how to subset fonts in a PDF file:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
{
SubsetFonts = true
};

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
id: optimize-images
url: viewer/net/optimize-images
title: Optimize images
weight: 4
description: "Optimize images in a PDF file using GroupDocs.Viewer for .NET (C#)"
productName: GroupDocs.Viewer for .NET
hideChildren: False
isMenuItemWithNoContent: True
---

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
id: optimization-pdf-convert-grayscale
url: viewer/net/optimization-pdf-convert-grayscale
title: Convert to grayscale
linkTitle: Convert to grayscale
weight: 3
description: "This topic describes how to convert PDF file to grayscale using the GroupDocs.Viewer .NET API (C#)."
keywords: convert to pdf, optimize size, pdf reduce size, convert to grayscale
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---
To speed up the printing of a PDF file and reduce its size, you can convert it from RGB color space to grayscale.

To convert a PDF file to grayscale, set the `ConvertToGrayScale` property to `true`.

The following code snippet shows how to convert a PDF file to grayscale:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
{
ConvertToGrayScale = true
};

viewer.View(viewOptions);
}
```
{{</ tab >}}
{{</ tabs >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
id: optimization-pdf-reduce-image-quality
url: viewer/net/optimization-pdf-reduce-image-quality
title: Reduce image quality
linkTitle: Reduce image quality
weight: 1
description: "This topic describes how to compress images in PDF file using the GroupDocs.Viewer .NET API (C#)."
keywords: convert to pdf, optimize size, pdf reduce size, compress images
productName: GroupDocs.Viewer for .NET
hideChildren: False
toc: True
---

If the output PDF file contains images, you can reduce its size using image compression.

To enable image compression, set the `CompressImages` property to `true`. The GroupDocs.Viewer compresses all images in the file.

The `ImageQuality` property determines the compression ratio. It is a quality value in percent. 100% means original quality.

The following code snippet shows how to compress images in the file:

{{< tabs "Example1">}}
{{< tab "C#" >}}
```csharp
using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
using GroupDocs.Viewer.Domain.Documents.PostProcessing.Pdf.Optimization;
// ...
using (var viewer = new Viewer("sample.docx"))
{
PdfViewOptions viewOptions = new PdfViewOptions();
viewOptions.PdfOptimizationOptions = new PdfOptimizationOptions()
{
CompressImages = true,
ImageQuality = 50
};

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


Loading

0 comments on commit 7f7b031

Please sign in to comment.