diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md new file mode 100644 index 0000000..59f5424 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md @@ -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. + + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md new file mode 100644 index 0000000..6ce366a --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md @@ -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); +} +``` +{{}} +{{}} + + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md new file mode 100644 index 0000000..613e821 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md @@ -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); +} +``` +{{}} +{{}} + + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md new file mode 100644 index 0000000..e8bbaf3 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md @@ -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); +} +``` +{{}} +{{}} + + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md new file mode 100644 index 0000000..554d77c --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md @@ -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 +--- + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md new file mode 100644 index 0000000..d963968 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md @@ -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); +} +``` +{{}} +{{}} diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md new file mode 100644 index 0000000..47e71a1 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md @@ -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); +} +``` +{{}} +{{}} + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md new file mode 100644 index 0000000..e51ff77 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md @@ -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 +--- + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md new file mode 100644 index 0000000..f3f47f2 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md @@ -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); +} +``` +{{}} +{{}} + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md new file mode 100644 index 0000000..5d5d6c9 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md @@ -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 +--- + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md new file mode 100644 index 0000000..3b40197 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md @@ -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); +} +``` +{{}} +{{}} \ No newline at end of file diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-reduce-image-quality.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-reduce-image-quality.md new file mode 100644 index 0000000..8ff1ea0 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-reduce-image-quality.md @@ -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); +} +``` +{{}} +{{}} + + diff --git a/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-set-max-resolution.md b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-set-max-resolution.md new file mode 100644 index 0000000..0502d53 --- /dev/null +++ b/net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-set-max-resolution.md @@ -0,0 +1,42 @@ +--- +id: optimization-pdf-set-max-resolution +url: viewer/net/optimization-pdf-set-max-resolution +title: Set image resolution +linkTitle: Set image resolution +weight: 2 +description: "This topic describes how to set image resolution in PDF file using the GroupDocs.Viewer .NET API (C#)." +keywords: convert to pdf, optimize size, pdf reduce size, set resolution +productName: GroupDocs.Viewer for .NET +hideChildren: False +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. + +The following code snippet shows how to reduce image resolution 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, + ResizeImages = true, + MaxResolution = 100 + }; + + viewer.View(viewOptions); +} +``` +{{}} +{{}} \ No newline at end of file diff --git a/net/developer-guide/retrieving-document-information/get-pdf-output-file-info.md b/net/developer-guide/retrieving-document-information/get-pdf-output-file-info.md new file mode 100644 index 0000000..303a5c6 --- /dev/null +++ b/net/developer-guide/retrieving-document-information/get-pdf-output-file-info.md @@ -0,0 +1,37 @@ +--- +id: get-pdf-output-file-info +url: viewer/net/get-pdf-output-file-info +title: Get the PDF output file information +weight: 6 +description: "This article explains how to get the PDF output file information using .NET / C# with GroupDocs.Viewer for .NET." +keywords: +productName: GroupDocs.Viewer for .NET +hideChildren: False +--- + +You can get the information about the PDF output file using the [GetViewInfo](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/viewer/methods/getviewinfo) method that returns a [ViewInfo](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/viewinfo) object. The object contains the [Pages](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/viewinfo/pages/) collection that represents each [Page](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.results/page/) of the document. + +The following code snippet shows how to get the page count and the width and height of each document page: + +{{< tabs "example1">}} +{{< tab "C#" >}} +```csharp +using (Viewer viewer = new Viewer("sample.pdf")) +{ + // Get file information. + ViewInfoOptions viewInfoOptions = ViewInfoOptions.ForPdfView(); + ViewInfo viewInfo = viewer.GetViewInfo(viewInfoOptions); + + // Display page count. + Console.WriteLine("Pages count: " + viewInfo.Pages.Count); + + // Display width and height of each page. + foreach (Page page in viewInfo.Pages) + { + Console.WriteLine($"Page: {page.Number}; Width: {page.Width}, pixels"); + Console.WriteLine($"Page: {page.Number}; Height: {page.Height}, pixels"); + } +} +``` +{{< /tab >}} +{{< /tabs >}} \ No newline at end of file