You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: "PDF Viewer - Adjust quality for JPG images"
2
+
id: "pdf-viewer-optimization-options"
3
+
url: "viewer/pdf-viewer-optimization-options"
4
+
title: "PDF Viewer - Optimization options"
5
5
productName: "GroupDocs.Viewer Cloud"
6
6
description: ""
7
7
keywords: ""
8
8
---
9
9
10
10
# Introduction #
11
11
12
-
When rendering documents to PDF format that contains JPG images it may be reasonable to reduce size of the output file by adjusting quality of the JPG images. GroupDocs.Viewer Cloud enables you to adjust quality of images in the output PDF document with JpgQuality setting of PdfOptions class. The supported values range of JpgQuality is from 1 to 100. Default value is 90.
12
+
GroupDocs.Viewer Cloud 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.
13
+
See [PdfOptimizationOptions]({{< ref "viewer/developer-guide/data-structures/pdfoptimizationoptions.md" >}}) for more information.
13
14
14
-
The following code sample shows how to adjust JPG image quality in the output PDF document.
15
+
The following code sample shows how to adjust image quality in the output PDF document.
PdfOptimizationOptions data structure contains the PDF optimization options to apply to the output PDF file.
12
+
13
+
##### ImageOptions example #####
14
+
15
+
```html
16
+
17
+
{
18
+
"Lineriaze": false,
19
+
"RemoveAnnotations": false,
20
+
"RemoveFormFields": false,
21
+
"ConvertToGrayScale": false,
22
+
"SubsetFonts": false,
23
+
"CompressImages": false,
24
+
"ImageQuality": 100,
25
+
"ResizeImages": false,
26
+
"MaxResolution": 300,
27
+
"OptimizeSpreadsheets": false
28
+
}
29
+
30
+
```
31
+
32
+
##### ImageOptions fields #####
33
+
34
+
|Name|Description
35
+
|---|---
36
+
|Lineriaze|Enables optimization the output PDF file for viewing online with a web browser. 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.
37
+
|RemoveAnnotations|Enables removing annotation from the output PDF file.
38
+
|RemoveFormFields|Enables removing form fields from a PDF file.
39
+
|ConvertToGrayScale|Enables converting the output PDF file to a grayscale.
40
+
|SubsetFonts|Subsets fonts in the output PDF file. If the file uses embedded fonts, it contains all font data. GroupDocs.Viewer Cloud can subset embedded fonts to reduce the file size.
41
+
|CompressImages|Enables compressing images in the output PDF file. Use this option to allow other compressing options: PdfOptimizationOptions.ImageQuality and PdfOptimizationOptions.MaxResolution.
42
+
|ImageQuality|Sets the image quality in the output PDF file (in percent). To change the image quality, first set the PdfOptimizationOptions.CompressImages property to true.
43
+
|ResizeImages|Enables setting the maximum resolution in the output PDF file. To allow this option, set the GroupDocs.Viewer.Options.PdfOptimizationOptions.CompressImages property to true. This option allows setting the GroupDocs.Viewer.Options.PdfOptimizationOptions.MaxResolution property.
44
+
|MaxResolution|Sets the maximum resolution in the output PDF file. To allow this option, set the GroupDocs.Viewer.Options.PdfOptimizationOptions.CompressImages and GroupDocs.Viewer.Options.PdfOptimizationOptions.MaxResolution properties to true. The default value is 300.
45
+
|OptimizeSpreadsheets|Enables optimization of spreadsheets in the PDF files. 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.
PdfOptions data structure inherits [RenderOptions]({{< ref "viewer/developer-guide/data-structures/renderoptions.md" >}}) and used as part of [ViewOptions]({{< ref "viewer/developer-guide/data-structures/viewoptions.md" >}}) data structure.
12
+
13
+
##### ImageOptions example #####
14
+
15
+
```html
16
+
17
+
{
18
+
"DocumentOpenPassword": "string",
19
+
"PermissionsPassword": "string",
20
+
"Permissions": ["AllowAll", "DenyModification"],
21
+
"PdfOptimizationOptions": {},
22
+
"ImageMaxWidth": 0,
23
+
"ImageMaxHeight": 0,
24
+
"ImageWidth": 0,
25
+
"ImageHeight": 0
26
+
}
27
+
28
+
```
29
+
30
+
##### ImageOptions fields #####
31
+
32
+
|Name|Description
33
+
|---|---
34
+
|RenderOptions fields|PdfOptions inherits all properties of [RenderOptions]({{< ref "viewer/developer-guide/data-structures/renderoptions.md" >}})
35
+
|DocumentOpenPassword|The password required to open the PDF document
36
+
|PermissionsPassword|The password required to change permission settings; Using a permissions password you can restrict printing, modification and data extraction
37
+
|Permissions|The array of PDF document permissions. Allowed values are: AllowAll, DenyPrinting, DenyModification, DenyDataExtraction, DenyAll. Default value is AllowAll, if now permissions are set.
38
+
|PdfOptimizationOptions|Contains options for rendering documents into PDF format. See [PdfOptimizationOptions]({{< ref "viewer/developer-guide/data-structures/pdfoptimizationoptions.md" >}})
39
+
|ImageMaxWidth|Max width of an output image in pixels. (When converting single image to PDF only)
40
+
|ImageMaxHeight|Max height of an output image in pixels. (When converting single image to PDF only)
41
+
|ImageWidth|The width of the output image in pixels. (When converting single image to PDF only)
42
+
|ImageHeight|The height of an output image in pixels. (When converting single image to PDF only)
0 commit comments