Skip to content

Commit

Permalink
Added screenshots for pdf optimization (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel-A-Sokolov committed Jul 5, 2023
1 parent 61433e0 commit e882bfc
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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`.
To remove annotations, set the [RemoveAnnotations](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/removeannotations/) property to `true`.

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

Expand All @@ -37,3 +37,7 @@ using (var viewer = new Viewer("sample.docx"))
```
{{</ tab >}}
{{</ tabs >}}

The following image demonstrates the result:

![Remove annotations](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-remove-annotations.png)
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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`.
To remove form fields, set the [RemoveFormFields](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/removeformfields) property to `true`.

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

Expand All @@ -38,3 +38,6 @@ using (var viewer = new Viewer("sample.docx"))
{{</ tab >}}
{{</ tabs >}}

The following image demonstrates the result:

![Remove fields](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-remove-fields.png)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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`.
To subset fonts in a PDF file, set the [SubsetFonts](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/subsetfonts) property to `true`.

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

Expand All @@ -41,3 +41,10 @@ using (var viewer = new Viewer("sample.docx"))
{{</ tab >}}
{{</ tabs >}}

The following image demonstrates the result. There is no difference in appearance:

![No difference in appearance](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-subset-fonts-appearance.png)

But there is the significant difference in size:

![Significant difference in size](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-subset-fonts-size.png)
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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`.
To convert a PDF file to grayscale, set the [ConvertToGrayScale](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/converttograyscale) property to `true`.

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

Expand All @@ -36,4 +36,8 @@ using (var viewer = new Viewer("sample.docx"))
}
```
{{</ tab >}}
{{</ tabs >}}
{{</ tabs >}}

The following image demonstrates the result:

![Convert to grayscale](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-convert-grayscale.png)
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ 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.
To enable image compression, set the [CompressImages](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/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 [ImageQuality](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/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:

Expand All @@ -42,4 +42,6 @@ using (var viewer = new Viewer("sample.docx"))
{{</ tab >}}
{{</ tabs >}}

The following image demonstrates the result:

![Reduce image quality](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-reduce-image-quality.png)
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ toc: True
---
If the output PDF file contains images, you can reduce its resolution.

To allow changing the image resolution, set the `CompressImages` and `ResizeImages` properties to `true`. The GroupDocs.Viewer compresses all images in the file. The `MaxResolution` property determines the maximum resolution.
To allow changing the image resolution, set the [CompressImages](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/compressimages/) and [ResizeImages](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/resizeimages/) properties to `true`. The GroupDocs.Viewer compresses all images in the file. The [MaxResolution](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfoptimizationoptions/maxresolution/) property determines the maximum resolution.

The following code snippet shows how to reduce image resolution in the file:

Expand All @@ -39,4 +39,8 @@ using (var viewer = new Viewer("sample.docx"))
}
```
{{</ tab >}}
{{</ tabs >}}
{{</ tabs >}}

The following image demonstrates the result:

![Set max resolution](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-set-max-resolution.png)
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ using (Viewer viewer = new Viewer("sample.pdf"))
}
```
{{< /tab >}}
{{< /tabs >}}
{{< /tabs >}}

The following image shows a sample console output:

![](/viewer/net/images/get_pdf_output_file_info.png)
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.
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.
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.
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/get_pdf_output_file_info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e882bfc

Please sign in to comment.