From 803efc8103060bdf4d69535f17db8d97c5697d86 Mon Sep 17 00:00:00 2001 From: Rakhim Aimaganbetov Date: Wed, 25 Sep 2024 19:32:51 +0500 Subject: [PATCH 1/4] Update system requirements and implement the CAD document rendering section --- .../getting-started/system-requirements.md | 3 + .../getting-started/troubleshooting/_index.md | 20 ++ .../how-to-install-libgdiplus.md | 73 +++++ .../troubleshooting/known-issues/_index.md | 11 + .../render-cad-documents/_index.md | 10 + .../render-cad-documents.md | 293 ++++++++++++++++++ .../specify-rendering-options.md | 171 ++++++++++ 7 files changed, 581 insertions(+) create mode 100644 python-net/getting-started/troubleshooting/_index.md create mode 100644 python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md create mode 100644 python-net/getting-started/troubleshooting/known-issues/_index.md create mode 100644 python-net/rendering-basics/render-cad-documents/_index.md create mode 100644 python-net/rendering-basics/render-cad-documents/render-cad-documents.md create mode 100644 python-net/rendering-basics/render-cad-documents/specify-rendering-options.md diff --git a/python-net/getting-started/system-requirements.md b/python-net/getting-started/system-requirements.md index f9e8d40..3c9eab3 100644 --- a/python-net/getting-started/system-requirements.md +++ b/python-net/getting-started/system-requirements.md @@ -33,6 +33,9 @@ GroupDocs.Viewer for Python can be used on any 32-bit or 64-bit operating system * Microsoft Windows 10 (x64, x86) * Microsoft Windows 11 (x64) +### Mac + +GroupDocs.Viewer for Python via .NET supports Mac OS X and so far only the ARM64 architecture. ## Development Environments diff --git a/python-net/getting-started/troubleshooting/_index.md b/python-net/getting-started/troubleshooting/_index.md new file mode 100644 index 0000000..5532ec3 --- /dev/null +++ b/python-net/getting-started/troubleshooting/_index.md @@ -0,0 +1,20 @@ +--- +id: troubleshooting +url: viewer/python-net/troubleshooting +title: Troubleshooting +weight: 8 +description: "This section contains issues that you may face and solutions for them when processing files with GroupDocs.Viewer." +keywords: +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- +This section describes issues that you may face processing files with GroupDocs.Viewer and solutions for them. The [Known issues]({{< ref "known-issues" >}}) subsection describes the limitations known. + +## On Linux, Chinese characters are garbled or rendered as boxes + +The usual cause is the language support is not installed, and there are no fonts to display the characters correctly. Please install the Asian language support as described in the articles listed below. + +## Related articles + +For details, please refer to the following pages: + diff --git a/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md b/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md new file mode 100644 index 0000000..e3d0d1f --- /dev/null +++ b/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md @@ -0,0 +1,73 @@ +--- +id: how-to-install-libgdiplus +url: viewer/python-net/how-to-install-libgdiplus +title: How to install libgdiplus library +weight: 2 +description: "This article will guide you through the installation of libgdiplus library." +keywords: libgdiplus, library, graphics +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- + +# Overview +If you're running GroupDocs.Viewer for Python via .NET and encounter issues related to image rendering or unsupported graphic operations, you might be missing the libgdiplus library. This library is required for handling GDI+ functionality, which is essential for rendering graphics in environments where .NET's System.Drawing is used. + +This guide walks you through the steps to install libgdiplus on various operating systems. + +# Installing libgdiplus +## For Ubuntu / Debian-based Systems +Follow the steps below to install libgdiplus: + +Update package list: +```bash +sudo apt-get update +``` +Install libgdiplus: + +```bash + +sudo apt-get install -y libgdiplus +``` +Create a symlink (required for compatibility): + +```bash +sudo ln -s libgdiplus.so /usr/lib/libgdiplus.so +``` +## For Red Hat / CentOS-based Systems +On Red Hat-based distributions like CentOS, use the following instructions: + +Enable the EPEL repository (for additional packages): +```bash +sudo yum install epel-release +``` +Install libgdiplus: +```bash +sudo yum install -y libgdiplus +``` +## For macOS +For macOS users, libgdiplus can be installed via Homebrew: + +Install Homebrew (if not installed): +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` +Install libgdiplus: +```bash +brew install mono-libgdiplus +``` +## For Windows +On Windows, you usually do not need libgdiplus, as GDI+ functionality is built-in with Windows. However, if you encounter any graphics-related issues, ensure that your .NET runtime and System.Drawing.Common libraries are correctly installed and up-to-date. + +Verifying Installation +After installing libgdiplus, you can verify that it is installed correctly by checking its version: + +```bash +ldconfig -p | grep libgdiplus +``` +This should return a result indicating the path to libgdiplus if it is installed correctly. + +### Common Issues +* Issue: "Cannot find libgdiplus.so" + * Solution: Ensure the symbolic link /usr/lib/libgdiplus.so exists. Re-run the ln -s command mentioned above. +* Issue: "System.Drawing.Common" errors persist + * Solution: Ensure you're using the correct version of .NET and that System.Drawing.Common is referenced in your project. \ No newline at end of file diff --git a/python-net/getting-started/troubleshooting/known-issues/_index.md b/python-net/getting-started/troubleshooting/known-issues/_index.md new file mode 100644 index 0000000..4824126 --- /dev/null +++ b/python-net/getting-started/troubleshooting/known-issues/_index.md @@ -0,0 +1,11 @@ +--- +id: known-issues +url: viewer/python-net/known-issues +title: Known issues +weight: 1 +description: "This section contains information about known GroupDocs.Viewer issues and limitations." +keywords: +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- + diff --git a/python-net/rendering-basics/render-cad-documents/_index.md b/python-net/rendering-basics/render-cad-documents/_index.md new file mode 100644 index 0000000..0cc69bc --- /dev/null +++ b/python-net/rendering-basics/render-cad-documents/_index.md @@ -0,0 +1,10 @@ +--- +id: render-cad-files +url: viewer/python-net/render-cad-files +title: Render CAD files +weight: 6 +description: "This section describes how to use GroupDocs.Viewer Python API to convert CAD files to PDF, HTML, PNG, and JPEG formats." +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +isMenuItemWithNoContent: True +--- diff --git a/python-net/rendering-basics/render-cad-documents/render-cad-documents.md b/python-net/rendering-basics/render-cad-documents/render-cad-documents.md new file mode 100644 index 0000000..57da669 --- /dev/null +++ b/python-net/rendering-basics/render-cad-documents/render-cad-documents.md @@ -0,0 +1,293 @@ +--- +id: render-cad-drawings-and-models +url: viewer/python-net/render-cad-drawings-and-models +title: Render CAD drawings and models as HTML, PDF, and image files +linkTitle: Render CAD drawings and models +weight: 1 +description: "This topic describes how to use the GroupDocs.Viewer Python API to convert CAD files (DWG, DGN, DXF) to HTML, PDF, PNG, and JPEG formats." +keywords: CAD viewer, dwg viewer, convert dwg to pdf, convert dwg to html, convert dwg to jpeg, convert dwg to image +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +toc: True +aliases: + - /viewer/python-net/how-to-view-cad-documents-using-csharp/ + - /viewer/python-net/view-cad-drawings + - /viewer/python-net/how-to-convert-and-view-igs-files + - /viewer/python-net/how-to-convert-and-view-cff2-and-cf2-files + - /viewer/python-net/how-to-convert-and-view-obj-files + - /viewer/python-net/how-to-view-plt-files + - /viewer/python-net/how-to-convert-cad-to-html + - /viewer/python-net/how-to-get-cad-layers-and-layouts + - /viewer/python-net/render-all-layouts + - /viewer/python-net/render-layers + - /viewer/python-net/how-to-view-dwf-file-layers +--- +[GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to render your CAD drawings and 3D models in HTML, PDF, PNG, and JPEG formats. You do not need to use AutoCAD or other CAD software to load and view CAD files within your Python application (web or desktop). + +Create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance to get started with the GroupDocs.Viewer API. Pass a CAD drawing you want to view to the class constructor. You can load the drawing from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the drawing to HTML, PDF, or image format. + +{{< button style="primary" link="https://products.groupdocs.app/viewer/cad" >}} {{< icon "gdoc_person" >}} View CAD files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} + +## Supported CAD file formats + +GroupDocs.Viewer supports the following CAD and 3D file formats: + +* [AutoCAD Drawing](https://docs.fileformat.com/cad/dwg/) (.DWG) +* [AutoCAD Drawing Template](https://docs.fileformat.com/cad/dwt) (.DWT) +* [Design Web Format](https://docs.fileformat.com/cad/dwf/) (.DWF) +* [Drawing Exchange Format](https://docs.fileformat.com/cad/dxf) (.DXF) +* [AutoCAD Plotter Document](https://docs.fileformat.com/cad/plt) (.PLT) +* [MicroStation Design File (V7)](https://docs.fileformat.com/cad/dgn) (.DGN) +* [Industry Foundation Classes](https://docs.fileformat.com/cad/ifc) (.IFC) +* [Stereolithography File](https://docs.fileformat.com/cad/stl) (.STL) +* [Wavefront 3D Object File](https://docs.fileformat.com/3d/obj/) (.OBJ) +* [Common File Format](https://docs.fileformat.com/cad/cf2/) (.CF2) +* [IGES (Initial Graphics Exchange Specification) Drawing](https://docs.fileformat.com/cad/igs/) (.IGS) +* [HPGL (Hewlett-Packard Graphics Language) Plot File](https://docs.fileformat.com/cad/hpgl/) (.HPG) + +GroupDocs.Viewer can detect the document format automatically based on information in the file header. + +## Render CAD drawings as HTML + +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to HTML. During the conversion, GroupDocs.Viewer creates an [SVG](https://docs.fileformat.com/page-description-language/svg/) image from the CAD drawing and embeds this image in an [HTML](https://docs.fileformat.com/web/html/) document. + +The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). + +### Create an HTML file with embedded resources + +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. + +{{< tabs "example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + # Create an HTML file for the drawing. + # Specify the HTML file name. + viewOptions = gvo.HtmlViewOptions.for_embedded_resources("output.html") + viewer.view(viewOptions) +``` +{{< /tab >}} + +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a CAD file to HTML](/viewer/net/images/rendering-basics/render-cad-documents/render-to-html-embedded-resources.png) + +### Create an HTML file with external resources + +If you want to store an HTML file and additional resource files (such as fonts, images, and style sheets) separately, call the [HtmlViewOptions.ForExternalResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: + + * The output file path format + * The path format for the folder with external resources + * The resource URL format + +{{< tabs "example2">}} +{{< tab "Python" >}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + # Create an HTML file for the drawing. + # Specify the HTML file name and location of external resources. + # {0} is replaced with the resource name. + viewOptions = gvo.HtmlViewOptions.for_external_resources("output.html", "output/resource_{0}", "output/resource_{0}") + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below demonstrates the result. External resources are placed in a separate folder. + +![Place HTML resources in a separate folder](/viewer/net/images/rendering-basics/render-cad-documents/render-to-html-external-resources.png) + +## Render CAD drawings as PDF + +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). + +{{< tabs "example3">}} +{{< tab "Python" >}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + # Create a PDF file for the drawing. + # Specify the PDF file name. + viewOptions = gvo.PdfViewOptions("output.pdf") + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a CAD file to PDF](/viewer/net/images/rendering-basics/render-cad-documents/render-cad-to-pdf.png) + +## Render CAD drawings as PNG + +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. + +{{< tabs "example4">}} +{{< tab "Python" >}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + # Create a PNG image for the drawing. + viewOptions = gvo.PngViewOptions("output.png") + # Set width and height. + viewOptions.width = 1500 + viewOptions.height = 1000 + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Render a CAD file to PNG](/viewer/net/images/rendering-basics/render-cad-documents/render-cad-to-png-image.png) + +## Render CAD drawings as JPEG + +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. + +{{< tabs "example5">}} +{{< tab "Python" >}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + # Create a JPG image for the drawing. + viewOptions = gvo.JpgViewOptions("output.jpg") + # Set width and height. + viewOptions.width = 1500 + viewOptions.height = 1000 + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Get information about existing layouts and layers + +Follow the steps below to obtain information about layouts and layers contained in a CAD drawing. You can use this information to specify which layers and layouts to display in the output file. + +1. Create a [ViewInfoOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions) instance for a specific view. +2. Call the [Viewer.GetViewInfo](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/#methods) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [CadViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo) type. +3. Use the [CadViewInfo.Layouts](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo/#properties) and [CadViewInfo.Layers](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo/#properties) properties to obtain the lists of layouts and layers in the CAD file. + +{{< tabs "example6">}} +{{< tab "Python" >}} +```python + with gv.Viewer("HousePlan.dwg") as viewer: + viewInfoOptions = gvo.ViewInfoOptions.for_html_view() + # Enable this option to see the list of all layouts contained in the CAD file. + viewInfoOptions.cad_options.render_layouts = True + + info = viewer.get_view_info(viewInfoOptions) + # Display information about the CAD file. + print("File type:", info.file_type) + print("Pages count:", len(info.pages)) + + # Display the list of existing layouts. + print("The drawing contains the following layout(s):") + for layout in info.layouts: + print(" - /", layout.name) + + # Display the list of existing layers. + print("The drawing contains the following layer(s):"); + for layer in info.layers: + print(" - /", layer) + + print("\nView info retrieved successfully.") +``` +{{}} +{{< /tabs >}} + +The following image shows a sample console output: + +![Get information about a CAD file](/viewer/net/images/rendering-basics/render-cad-documents/retrieve-cad-file-information.png) + +## Render all or specific layouts + +When you convert a CAD drawing to HTML, PDF, or image format, GroupDocs.Viewer renders only the model-space layout (*Model*). If you also need to render all paper space layouts contained in your CAD file, enable the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) option for one of the following classes (depending on the output file format): + +* [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) +* [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) +* [PngViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pngviewoptions) +* [JpgViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/jpgviewoptions) + +Each layout is rendered on a separate page. + +The following example renders all layouts when converting a CAD drawing to PDF: + +{{< tabs "example7">}} +{{< tab "Python">}} +```python +with gv.Viewer("sample.dwg") as viewer: + # Convert the document to PDF. + options = gvo.PdfViewOptions("output.pdf") + # Render the Model and all non-empty paper space layouts. + options.cad_options.render_layouts = True + viewer.view(options) +``` +{{< /tab >}} +{{< /tabs >}} + +To render a specific layout, assign the layout name to the [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property of a target view. + +{{< tabs "example8">}} +{{< tab "Python">}} +```python +with gv.Viewer("sample.dwg") as viewer: + # Convert the document to PDF. + options = gvo.PdfViewOptions("output.pdf") + # Specify the name of the layout to render. + # If the specified layout is not found, + # an exception occurs. + options.cad_options.layout_name = "layout1" + viewer.view(options) +``` +{{< /tab >}} +{{< /tabs >}} + +{{< alert style="info" >}} +1. The [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) and [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) properties apply only to the following file formats: DWG, DWT, DXF, and DWF. + +2. If you use the [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to render a specific layout, the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) option is ignored.{{< /alert >}} + + +## Render specific layers + +A CAD drawing can contain many layers. Each layer is used to draw a specific object type. For example, the drawing below contains layers for walls, furniture, plants, and so on. You can control the visibility of objects on the drawing by turning specific layers on or off. + +![Layers in a CAD file](/viewer/net/images/rendering-basics/render-cad-documents/autocad-drawing-layers.png) + +When you convert a CAD drawing to HTML, PDF, or image format, GroupDocs.Viewer renders all available layers. You can specify which layers to display in the output file, as described below: + +1. Access the [CadOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property for a target view: + + * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) + * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) + * [PngViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pngviewoptions) + * [JpgViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/jpgviewoptions) + +2. Assign the list of layers you want to render to the [CadOptions.Layers](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/cadoptions/#properties) property. + +The following example renders layers with walls and furniture to PDF: + +{{< tabs "example9">}} +{{< tab "Python">}} +```python +import groupdocs.viewer as gv +import groupdocs.viewer.options as gvo +import groupdocs.viewer.results as gvr + +with gv.Viewer("HousePlan.dwg") as viewer: + # Convert the document to PDF. + options = gvo.PdfViewOptions("output.pdf") + # Specify a list of layers to display. + options.cad_options.layers = [ + gvr.Layer("Base"), + gvr.Layer("Walls"), + gvr.Layer("Furniture") + ] + viewer.view(options) +``` +{{< /tab >}} +{{< /tabs >}} + +The image below illustrates the result. + +![Render specific CAD layers](/viewer/net/images/rendering-basics/render-cad-documents/render-specific-layers.png) diff --git a/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md b/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md new file mode 100644 index 0000000..a4c93c9 --- /dev/null +++ b/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md @@ -0,0 +1,171 @@ +--- +id: specify-cad-rendering-options +url: viewer/python-net/specify-cad-rendering-options +title: Specify rendering options for CAD files +linkTitle: Specify rendering options +weight: 2 +description: "This topic describes how to use the GroupDocs.Viewer .NET API (C#) to specify various options for rendering CAD files to HTML, PDF, PNG, and JPEG." +keywords: set background color, change image size, split drawing into tiles, dwg to pdf, cad to pdf, dwg to html, cad to html, dwg to image +productName: GroupDocs.Viewer for .NET +hideChildren: False +toc: True +aliases: + - /viewer/python-net/how-to-set-background-color-when-converting-cad-drawings + - /viewer/python-net/split-drawing-into-tiles + - /viewer/python-net/adjust-output-image-size + - /viewer/python-net/how-to-apply-pc3-config-file +--- +GroupDocs.Viewer ships with the [CadOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class that allows you to specify different options for [rendering CAD files](/viewer/python-net/render-cad-documents/). To access these options, use the [CadOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property for one of the following classes (depending on the output file format): + +* [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) +* [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) +* [PngViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pngviewoptions) +* [JpgViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/jpgviewoptions) + +## Specify the background color + +Use the [CadOptions.BackgroundColor](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to specify the background color for the output file. + +The following code snippet converts a CAD drawing to PDF and sets the background color of PDF pages to light yellow: + +{{< tabs "example1">}} +{{< tab "Python">}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + viewOptions = gvo.PdfViewOptions("output.pdf") + viewOptions.cad_options.background_color = drawing.Argb32Color.TRANSPARENT # RGB color for green + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image illustrates the result: + +![Specify the background color for the output PDF file](/viewer/net/images/rendering-basics/render-cad-documents/set-background-color.png) + +## Configure the output image size + +When rendering a CAD drawing, GroupDocs.Viewer creates an image with the largest dimension (width or height) set to 2000 pixels. The other dimension is calculated based on the aspect ratio of the original drawing. You can use the following methods to change the width and height of the output file: + +* [CadOptions.ForRenderingByWidth](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image width in pixels. The image height is calculated based on the aspect ratio of the original CAD drawing. +* [CadOptions.ForRenderingByHeight](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image height in pixels. The image width is calculated based on the aspect ratio of the original CAD drawing. +* [CadOptions.ForRenderingByWidthAndHeigh](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image width and height in pixels. +* [CadOptions.ForRenderingByScaleFactor](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies a scale factor to apply to the output image. Values between 0 and 1 decrease the image size, and values greater than 1 increase the image. + +The following example converts a CAD drawing to PNG format and reduces the width and height of the output image by 50%: + +{{< tabs "example2">}} +{{< tab "Python">}} +```python +with gv.Viewer("HousePlan.dwg") as viewer: + # Convert the diagram to PNG. + png_options = gvo.PngViewOptions("output.png") + # Specify a scale factor. + png_options.cad_options = gvo.CadOptions.for_rendering_by_scale_factor(0.5) + viewer.view(png_options) +``` +{{< /tab >}} +{{< /tabs >}} + +When you render all layouts/sheets contained in a CAD file (the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) property is `true`), each layout/sheet is rendered as a separate page/image and has its own size. In this case, when you specify only the [width](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods) or [height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods) value, the other side is scaled proportionally to maintain the aspect ratio of each layout/sheet. When you set both [width and height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods), all generated images have the same size and may look distorted. To avoid this, use the [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to render each layout/sheet separately and set its size. + +### Apply the PC3 file settings + +AutoCAD allows you to configure plotter settings and save them as a PC3 file (Plotter Configuration Version 3) for later use. With GroupDocs.Viewer, you can apply width and height values from a PC3 file to the output file when you convert your CAD drawing to HTML, PDF, or image format. Use the [CadOptions.Pc3File](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property for a target view to specify a path to the PC3 file with required settings. The default location for PC3 files is "*C:\Users\\[Username]\\AppData\Roaming\Autodesk\AutoCAD [Version]\\[Version Code]\\[Language]\Plotters*". + +{{< tabs "example3">}} +{{< tab "Python">}} +```python +with gv.Viewer("sample.dwg") as viewer: + # Convert the diagram to PDF. + viewOptions = gvo.PdfViewOptions("output.pdf") + # Specify a path to the PC3 file. + viewOptions.cad_options.pc_3_file = "small_page.pc3" + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Split a drawing into tiles + +With GroupDocs.Viewer, you can split a CAD drawing (in DWG or DWT format) into parts (_tiles_) and render each part separately. Tiled rendering allows you to reduce memory usage when you convert large drawings to HTML, PDF, or image format. When tiled rendering is enabled, GroupDocs.Viewer renders only the model space layout (_Model_) and ignores the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) and [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property values. + +![Split a CAD drawing into tiles](/viewer/net/images/rendering-basics/render-cad-documents/split-drawing-into-tiles.png) + +To create an individual tile, instantiate a [Tile](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/tile) object. Specify the x- and y-coordinates of the tile's lower-left corner and the tile width and height (in pixels). The image below illustrates a coordinate system used to define the tile position. The origin (0,0) is located in the lower-left corner of the drawing. The positive x-axis extends horizontally to the right, and the positive y-axis is oriented vertically from bottom to top. + +![Tile coordinates](/viewer/net/images/rendering-basics/render-cad-documents/tile-coordinates.png) + +After you create all tiles, add them to the [ViewOptions.CadOptions.Tiles](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) list and call the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert these tiles to a desired format. Each tile will be rendered as a separate page/image. + +The following example demonstrates how to split a CAD drawing into four tiles (2x2) of equal size: + +{{< tabs "example4">}} +{{< tab "Python">}} +```python +viewInfoOptions = gvo.ViewInfoOptions.for_html_view() +viewInfo = viewer.get_view_info(viewInfoOptions) + +# Get the width and height of the CAD drawing. +width = view_info.pages[0].width +height = view_info.pages[0].height + +# Specify the number of rows and columns to split the drawing into. +columns = 2 +rows = 2 + +# Calculate the width and height of each tile. +tile_width = width / columns +tile_height = height / rows +point_x = 0 +point_y = 0 + +# Split the drawing into tiles and convert them to HTML. +# {0} is replaced with the tile number in the output file name. +with gv.Viewer("HousePlan.dwg") as viewer: + viewOptions = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html") + for i in range(0, columns): + for j in range(0, rows): + tile = gvo.Tile(point_x + tile_width * i, point_y + tile_height * j, tile_width, tile_height) + viewOptions.cad_options.tiles.append(tile) + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +In the example above the GroupDocs.Viewer will generate four HTML files named "page_1.html", "page_2.html", "page_3.html", and "page_4.html", where each of these HTML file contains a single tile in a form of SVG vector image. The [`HtmlViewOptions.ForExternalResources()`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) static method (with all its overloads) can also be used — in such case the SVG files will not be embedded inside the output HTML files, but will be saved separately, while HTML only references them through the `A` HTML element. + +Starting from this 24.9 version the CAD tiled rendering is also supported for the PDF — in that case the GroupDocs.Viewer generates a single PDF file, where one its page represents one tile. So, if in the example above we replace the [`HtmlViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) onto the [`PdfViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/), then the GroupDocs.Viewer will produce one PDF file with four pages inside it. + +## Choose rendering speed instead of quality + +By default the GroupDocs.Viewer converts and renders all documents within CAD format family with the max possible quality. In case when the input CAD file (DWG, for example) is very complex, it may lead to quite significant processing time. Also, the size of the generated output HTML or image (vector or raster) also may be too heavy. + +Starting from this version 24.9 the GroupDocs.Viewer introduces a new public property within the [`CadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class — the `EnablePerformanceConversionMode` boolean flag. By default it is set to `false` - the GroupDocs.Viewer behaves as in previous versions, preserving the maximum quality. But when setting its value to `true`, then the performance-oriented conversion mode is enabled, which leads to significantly lesser conversion time as well as lesser byte size of the output document. + +Enabling this mode is pretty simple — just create an instance of the [`CadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class by using [any of the static # described above](#ctors), and then set the value for the `EnablePerformanceConversionMode` property. Example is below: + + +{{< tabs "example5">}} +{{< tab "Python">}} +```python +with gv.Viewer("input.dwg") as viewer: + viewOptions = gvo.HtmlViewOptions.for_embedded_resources("Output-Page#{0}.html") + viewOptions.cad_options = gvo.CadOptions.for_rendering_by_width(1000) + viewOptions.cad_options.enable_performance_conversion_mode = True + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +If taking an ordinary DWG file as a sample, the comparison between "quality" and "performance" modes are the next: + +| Conversion mode | Output file size, MiB | Processing time, sec | +| --- | --- | --- | --- | --- | +| Quality-oriented (default) | 46.8 | 7.87 | +| Performance-oriented (new) | 5.04 | 4.47 | + +Screenshot below illustrates the visual differences between these modes, default quality-oriented mode is on the left side, and the new performance-oriented mode is on the right side: + +![DWG quality vs. performance](/viewer/net/images/rendering-basics/render-cad-documents/dwg_comparison_quality_vs_performance.png) From 25e5b2d877e4e4783a234490bb4bdd894b2baa6f Mon Sep 17 00:00:00 2001 From: Rakhim Aimaganbetov Date: Thu, 26 Sep 2024 17:06:03 +0500 Subject: [PATCH 2/4] Update Class, Method & Property namings with PySignature --- python-net/developer-guide/_index.md | 4 +- .../developer-guide/caching-results/_index.md | 46 ++++++++----- .../how-to-extract-and-save-attachments.md | 6 +- .../rendering-documents/add-text-watermark.md | 25 ++++--- .../rendering-to-html/_index.md | 6 +- .../rendering-to-pdf/_index.md | 6 +- .../how-to-get-file-type-and-pages-count.md | 18 +++-- python-net/getting-started/installation.md | 2 +- .../licensing-and-subscription.md | 8 +-- .../how-to-install-libgdiplus.md | 5 +- .../rendering-basics/render-archive-files.md | 28 ++++---- .../render-cad-documents.md | 22 +++--- .../specify-rendering-options.md | 24 +++---- python-net/rendering-basics/render-ebooks.md | 14 ++-- .../rendering-basics/render-email-messages.md | 24 +++---- python-net/rendering-basics/render-images.md | 20 +++--- .../render-lotus-notes-files.md | 18 ++--- .../render-ms-project-files.md | 42 ++++-------- .../render-outlook-data-files.md | 20 +++--- .../rendering-basics/render-pdf-documents.md | 68 +++++++++++-------- .../rendering-basics/render-presentations.md | 20 +++--- ...er-excel-and-apple-numbers-spreadsheets.md | 26 +++---- .../specify-rendering-options.md | 40 +++++------ .../split-worksheet-into-pages.md | 8 +-- .../rendering-basics/render-text-files.md | 16 ++--- .../render-visio-documents.md | 32 ++++----- .../rendering-basics/render-web-documents.md | 14 ++-- .../rendering-basics/render-word-documents.md | 42 ++++++------ 28 files changed, 305 insertions(+), 299 deletions(-) diff --git a/python-net/developer-guide/_index.md b/python-net/developer-guide/_index.md index 89365ab..791e48d 100644 --- a/python-net/developer-guide/_index.md +++ b/python-net/developer-guide/_index.md @@ -3,8 +3,8 @@ id: developer-guide url: viewer/python-net/developer-guide title: Developer Guide weight: 4 -description: "Explains GroupDocs.Viewer for Python file viewer features and shows how to view PDF, Word, Excel, PowerPoint documents inside your JavaScript applications" -keywords: GroupDocs.Viewer Developer Guide, GroupDocs.Viewer Java Developer Guide, GroupDocs.Viewer Developer Guide Java, Using GroupDocs.Viewer for Python, GroupDocs.Viewer for Python use cases +description: "Explains GroupDocs.Viewer for Python file viewer features and shows how to view PDF, Word, Excel, PowerPoint documents inside your Python applications" +keywords: GroupDocs.Viewer Developer Guide, GroupDocs.Viewer Python Developer Guide, GroupDocs.Viewer Developer Guide Python, Using GroupDocs.Viewer for Python, GroupDocs.Viewer for Python use cases productName: GroupDocs.Viewer for Python via .NET hideChildren: False isMenuItemWithNoContent: True diff --git a/python-net/developer-guide/caching-results/_index.md b/python-net/developer-guide/caching-results/_index.md index 895b0b4..6976141 100644 --- a/python-net/developer-guide/caching-results/_index.md +++ b/python-net/developer-guide/caching-results/_index.md @@ -21,24 +21,34 @@ To enable caching, follow these steps: The following code snippet shows how to enable caching and displays the difference between rendering a file and getting the cached results: {{< tabs "example1">}} -{{< tab "JavaScript" >}} -```js -const cachePath = "cache"; -const cache = new FileCache(cachePath); -const settings = new ViewerSettings(cache); - -const viewer = new groupdocs.viewer.Viewer("sample.docx", settings) -const options = HtmlViewOptions.forEmbeddedResources(); -const currentTimeMillis = Date.now() - -viewer.view(options); -currentTimeMillis = Date.now() - currentTimeMillis -console.log("Time taken on first call to View method " + currentTimeMillis + " (ms).") -currentTimeMillis = Date.now() - -viewer.view(options) -currentTimeMillis = Date.now() - currentTimeMillis -console.log("Time taken on second call to View method " + currentTimeMillis + " (ms).") +{{< tab "Python" >}} +```python +import time +import groupdocs.viewer as gv +import groupdocs.viewer.options as gvo + +# Define a path to cache +cache_path = "cache" +cache = gv.FileCache(cache_path) +settings = gv.ViewerSettings(cache) + +# Define a Viewer for a "sample.docx" file +with gv.Viewer("sample.docx", settings) as viewer: + options = gvo.HtmlViewOptions.for_embedded_resources() + + # Define the execution time of the first call + start_time = time.time() + viewer.view(options) + + elapsed_time = time.time() - start_time + print(f"Time taken on first call to View method {elapsed_time * 1000:.0f} (ms).") + + # Define the execution time of the second call + start_time = time.time() + viewer.view(options) + + elapsed_time = time.time() - start_time + print(f"Time taken on second call to View method {elapsed_time * 1000:.0f} (ms).") ``` {{< /tab >}} {{< /tabs >}} diff --git a/python-net/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md b/python-net/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md index 174d951..d0d0e72 100644 --- a/python-net/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md +++ b/python-net/developer-guide/processing-attachments/how-to-extract-and-save-attachments.md @@ -10,9 +10,9 @@ hideChildren: False --- To get and save attachments, follow these steps: -1. Instantiate the [Viewer](#) object. Specify a file that contains attachments. -2. Call the [getAttachments](#) method. It returns the attachment collection. -3. Iterate through the collection. To save an attachment, call the [saveAttachment](#) method. +1. Instantiate the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) object. Specify a file that contains attachments. +2. Call the [get_attachments](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. It returns the attachment collection. +3. Iterate through the collection. To save an attachment, call the [save_attachment](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. The following code snippet shows how to get and save all attachments from the MSG file: diff --git a/python-net/developer-guide/rendering-documents/add-text-watermark.md b/python-net/developer-guide/rendering-documents/add-text-watermark.md index b3a63a4..ea36fcb 100644 --- a/python-net/developer-guide/rendering-documents/add-text-watermark.md +++ b/python-net/developer-guide/rendering-documents/add-text-watermark.md @@ -10,23 +10,22 @@ hideChildren: False --- To add a watermark to the HTML/JPG/PNG/PDF output, follow these steps: -1. Create an instance of the [HtmlViewOptions](#) class (or [PngViewOptions](#), or [JpgViewOptions](#), or [PdfViewOptions](#)); -2. Create a [Watermark](#) object and populate its properties; -3. Call the [setWatermark](#) method of the [HtmlViewOptions](#) (or [PngViewOptions](#), or [JpgViewOptions](#), or [PdfViewOptions](#)) class and specify the object created on step 2; -4. Call the [Viewer.view()](#) method. +1. Create an instance of the [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) class (or [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/), or [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/), or [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/)); +2. Create a [Watermark](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/watermark/) object and populate its properties; +3. Call the [watermark](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/#properties) method of the [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) (or [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/), or [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/), or [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/)) class and specify the object created on step 2; +4. Call the [Viewer.view()](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. The following code snippet shows how to apply the watermark to the output pages. {{< tabs "example1">}} -{{< tab "JavaScript" >}} -```js -const viewer = new groupdocs.viewer.Viewer("sample.docx") -// Create an HTML file. -const viewOptions = groupdocs.viewer.HtmlViewOptions.forEmbeddedResources(output-watermark.html) -// Add watermark. -const watermark = new groupdocs.viewer.Watermark('This is a watermark') -viewOptions.setWatermark(watermark); -viewer.view(viewOptions) +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + # Create an HTML file. + viewOptions = gvo.HtmlViewOptions.for_embedded_resources("output-watermark.html") + # Add watermark. + viewOptions.watermark = gvo.Watermark("This is a watermark") + viewer.view(viewOptions) ``` {{< /tab >}} {{< /tabs >}} \ No newline at end of file diff --git a/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md b/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md index ce2f7dd..7ec2b2a 100644 --- a/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md +++ b/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md @@ -18,9 +18,9 @@ GroupDocs.Viewer for Python provides two options to manage CSS, fonts, images, a To render files to HTML, follow these steps: -1. Create an instance of the [Viewer](#) class. Specify the source document path as a constructor parameter. -2. Instantiate the [HtmlViewOptions](#) object. Specify a path to save the rendered pages. -3. Call the [View.view()](#) method of the [Viewer](#) object. Specify the [HtmlViewOptions](#) object as the parameter. +1. Create an instance of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class. Specify the source document path as a constructor parameter. +2. Instantiate the [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) object. Specify a path to save the rendered pages. +3. Call the [View.view()](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) object. Specify the [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) object as the parameter. ## Rendering to HTML with external resources diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md index a2983eb..b14789e 100644 --- a/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md @@ -12,9 +12,9 @@ When rendering to PDF, GroupDocs.Viewer renders all pages of the source document To render files to PDF, follow these steps: -1. Create an instance of the [Viewer](#) class. Specify the source document path as a constructor parameter. -2. Instantiate the [PdfViewOptions](#) object. Specify a path to save the rendered file. -3. Call the [View.view()](#) method of the [Viewer](#) object. Specify the [PdfViewOptions](#) object as the parameter. +1. Create an instance of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class. Specify the source document path as a constructor parameter. +2. Instantiate the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) object. Specify a path to save the rendered file. +3. Call the [View.view()](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) object. Specify the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) object as the parameter. The following code snippet shows how to render a .docx document to PDF: diff --git a/python-net/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md b/python-net/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md index 64551f4..c4d0a15 100644 --- a/python-net/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md +++ b/python-net/developer-guide/retrieving-document-information/how-to-get-file-type-and-pages-count.md @@ -10,15 +10,15 @@ hideChildren: False --- A format family is a group of several file types for which an application provides additional information. For example, archive files (.7z, .rar, .zip, etc.) or Outlook files (.ost, .pst) are format families. -You can get the format family and the additional information using the [getViewInfo](#) method that returns a [ViewInfo](#) object. +You can get the format family and the additional information using the [get_view_info](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method that returns a [ViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/viewinfo/) object. GroupDocs.Viewer provides additional information for the following format families: -* Archive files - a collection of folders in the archive (see [Obtain information about folders in an archive file](#); -* CAD drawings - a collection of layouts and layers (see [Obtain information about existing layouts and layers](#)); -* Outlook data files - a collection of folders (see [Obtain information about folders in an Outlook data file](#)); -* PDF documents - a flag that indicates whether document printing is allowed (see [Obtain information about a PDF file](#)); -* Microsoft Project files - the project's start and end dates (see [Obtain information about a Project file](#)). +* Archive files - a collection of folders in the archive (see [Obtain information about folders in an archive file]({{< ref "/viewer/python-net/rendering-basics/render-archive-files.md" >}})); +* CAD drawings - a collection of layouts and layers (see [Obtain information about existing layouts and layers]({{< ref "/viewer/python-net/rendering-basics/render-cad-documents/render-cad-documents.md" >}})); +* Outlook data files - a collection of folders (see [Obtain information about folders in an Outlook data file]({{< ref "/viewer/python-net/rendering-basics/render-outlook-data-files.md" >}})); +* PDF documents - a flag that indicates whether document printing is allowed (see [Obtain information about a PDF file]({{< ref "/viewer/python-net/rendering-basics/render-pdf-documents.md" >}})); +* Microsoft Project files - the project's start and end dates (see [Obtain information about a Project file]({{< ref "/viewer/python-net/rendering-basics/render-ms-project-files.md" >}})). ## Get the file type and the pages count from a file @@ -27,7 +27,11 @@ The following code snippet shows how to get the file type and the pages count fr {{< tabs "example1">}} {{< tab "Python" >}} ```python -with gv.Viewer(test_files.sample_pdf) as viewer: +import groupdocs.viewer as gv +import groupdocs.viewer.options as gvo +import groupdocs.viewer.results as gvr + +with gv.Viewer("sample.pdf") as viewer: options = gvo.ViewInfoOptions.for_html_view() info = viewer.get_view_info(options) pdf_info = cast(gvr.PdfViewInfo, info) diff --git a/python-net/getting-started/installation.md b/python-net/getting-started/installation.md index 542a141..460de22 100644 --- a/python-net/getting-started/installation.md +++ b/python-net/getting-started/installation.md @@ -21,7 +21,7 @@ pip install groupdocs-viewer-net ## Download GroupDocs.Viewer from the official website -Visit [https://releases.groupdocs.com/viewer/python-net/](https://releases.groupdocs.com/viewer/net/) and download the **GroupDocs.Viewer** assemblies. +Visit [https://releases.groupdocs.com/viewer/python-net/](https://releases.groupdocs.com/viewer/python-net/) and download the **GroupDocs.Viewer** assemblies. 1. Download the Wheel File: On the download page, locate the latest version of the **GroupDocs.Viewer** package. Click on the download link to download the wheel file containing the package. diff --git a/python-net/getting-started/licensing-and-subscription.md b/python-net/getting-started/licensing-and-subscription.md index 451f72e..8a16588 100644 --- a/python-net/getting-started/licensing-and-subscription.md +++ b/python-net/getting-started/licensing-and-subscription.md @@ -40,11 +40,11 @@ Licenses can be applied from different locations: When you reference _GroupDocs.Viewer.dll_ in the application, the library is copied to your output directory (unless **Copy Local** in the properties for that entry is set to false). The easiest way to set a license is often to place the license file in the same folder as _GroupDocs.Viewer.dll_ and specify just the filename without the path. -Use the [setLicense](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/license/setlicense/) method to license a component. +Use the [set_license](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/license/#methods) method to license a component. -Calling `setLicense` multiple times is not harmful, it simply wastes processor time. +Calling `set_license` multiple times is not harmful, it simply wastes processor time. -Calling [setMeteredKey](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/metered/setmeteredkey/) multiple times is not harmful either but wastes processor time and can accumulate consumption improperly. +Calling [set_metered_key](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/metered/#methods) multiple times is not harmful either but wastes processor time and can accumulate consumption improperly. #### Apply the License @@ -98,7 +98,7 @@ You do not have to name the license file "GroupDocs.Viewer.lic". Feel free to re When you buy and download a license from the GroupDocs website, the license file is named "GroupDocs.Viewer.lic." Download it using your browser. Sometimes, browsers recognize it as XML and add the .xml extension, making the full file name "GroupDocs.Viewer.lic.XML" on your computer. -If Microsoft Windows is set to hide file extensions (which is the default in most installations), the license file will show as "GroupDocs.Viewer.lic" in Windows Explorer. You might assume this is the actual file name and call the `setLicense` method with "GroupDocs.Viewer.lic", but there is no such file, leading to an exception. +If Microsoft Windows is set to hide file extensions (which is the default in most installations), the license file will show as "GroupDocs.Viewer.lic" in Windows Explorer. You might assume this is the actual file name and call the `set_license` method with "GroupDocs.Viewer.lic", but there is no such file, leading to an exception. To fix this issue, rename the file to remove the hidden .xml extension. Additionally, we suggest disabling the "Hide extensions" option in Microsoft Windows. diff --git a/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md b/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md index e3d0d1f..278d9f7 100644 --- a/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md +++ b/python-net/getting-started/troubleshooting/how-to-install-libgdiplus.md @@ -25,13 +25,12 @@ sudo apt-get update Install libgdiplus: ```bash - sudo apt-get install -y libgdiplus ``` Create a symlink (required for compatibility): ```bash -sudo ln -s libgdiplus.so /usr/lib/libgdiplus.so +sudo ln -s libgdipls.so /usr/lib/libgdiplus.so ``` ## For Red Hat / CentOS-based Systems On Red Hat-based distributions like CentOS, use the following instructions: @@ -68,6 +67,6 @@ This should return a result indicating the path to libgdiplus if it is installed ### Common Issues * Issue: "Cannot find libgdiplus.so" - * Solution: Ensure the symbolic link /usr/lib/libgdiplus.so exists. Re-run the ln -s command mentioned above. + * Solution: Ensure the symbolic link `/usr/lib/libgdiplus.so` exists. Re-run the `ln -s` command mentioned above. * Issue: "System.Drawing.Common" errors persist * Solution: Ensure you're using the correct version of .NET and that System.Drawing.Common is referenced in your project. \ No newline at end of file diff --git a/python-net/rendering-basics/render-archive-files.md b/python-net/rendering-basics/render-archive-files.md index 2a9243a..3abe0a1 100644 --- a/python-net/rendering-basics/render-archive-files.md +++ b/python-net/rendering-basics/render-archive-files.md @@ -24,7 +24,7 @@ aliases: --- [GroupDocs.Viewer for Python via .Net](https://products.groupdocs.com/viewer/python-net) allows you to view the contents of archive files in HTML, PDF, PNG, and JPEG formats. You do not need to use third-party file archiver and compression software to display archive file contents within your .NET application (web or desktop). -To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass an archive file you want to view to the class constructor. You can load the archive from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the archive file to HTML, PDF, or image format. +To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass an archive file you want to view to the class constructor. You can load the archive from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the archive file to HTML, PDF, or image format. {{< button style="primary" link="https://products.groupdocs.app/viewer/archive" >}} {{< icon "gdoc_person" >}} View archive files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -46,7 +46,7 @@ GroupDocs.Viewer can detect the archive file format automatically based on infor ## Render archive files as HTML -To convert an archive file to HTML, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method to create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass this instance to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method. +To convert an archive file to HTML, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method to create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass this instance to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. {{< tabs "example1">}} {{< tab "Python" >}} @@ -66,7 +66,7 @@ The following image demonstrates the result: ### Specify the number of items to render -GroupDocs.Viewer supports the [HtmlViewOptions.ArchiveOptions.ItemsPerPage](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/archiveoptions/itemsperpage/) option that allows you to specify the number of archive items to display on each HTML page. The default property value is **16**. +GroupDocs.Viewer supports the [HtmlViewOptions.archive_options.items_per_page](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/archiveoptions/#properties) option that allows you to specify the number of archive items to display on each HTML page. The default property value is **16**. The following example demonstrates how to set this option in code: @@ -86,7 +86,7 @@ with gv.Viewer("Documents.zip") as viewer: ### Create a single HTML page -If you need to display the contents of an archive file on a single HTML page, enable the [HtmlViewOptions.RenderToSinglePage](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/rendertosinglepage/) option, as shown below: +If you need to display the contents of an archive file on a single HTML page, enable the [HtmlViewOptions.render_to_single_page](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#properties) option, as shown below: {{< tabs "example3">}} {{< tab "Python" >}} @@ -107,7 +107,7 @@ The animation below demonstrates the result. You can navigate between the archiv ## Render archive files as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an archive file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file or reorder its pages. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an archive file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file or reorder its pages. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example4">}} {{< tab "Python" >}} @@ -126,7 +126,7 @@ The following image demonstrates the result: ## Render archive files as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an archive file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an archive file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -149,7 +149,7 @@ The following image demonstrates the result: ## Render archive files as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an archive file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an archive file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example6">}} {{< tab "Python" >}} @@ -171,8 +171,8 @@ with gv.Viewer("Documents.zip") as viewer: Follow the steps below to obtain information about folders contained in an archive file. You can use this information to [specify which folder to display in the output file](#render-a-specific-folder). 1. Create a [ViewInfoOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions) instance for a specific view. -2. Call the [Viewer.GetViewInfo](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/methods/getviewinfo) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [ArchiveViewInfo](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.results/archiveviewinfo) type. -3. Use the [ArchiveViewInfo.Folders](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/archiveviewinfo/folders/) property to obtain the lists of folders in the archive file. +2. Call the [Viewer.get_view_info](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/#methods) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [ArchiveViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/archiveviewinfo) type. +3. Use the [ArchiveViewInfo.folders](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/archiveviewinfo/#properties) property to obtain the lists of folders in the archive file. {{< tabs "example7">}} {{< tab "Python" >}} @@ -218,7 +218,7 @@ GroupDocs.Viewer also allows you to list and extract all files contained in the ## Render a specific folder -When you convert an archive file to HTML, PDF, or image format, GroupDocs.Viewer renders items from all folders contained in the archive. If you need to render items from a specific folder, specify the [ArchiveOptions.Folder](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/archiveoptions/properties/folder) property for one of the following classes (depending on the output file format): +When you convert an archive file to HTML, PDF, or image format, GroupDocs.Viewer renders items from all folders contained in the archive. If you need to render items from a specific folder, specify the [ArchiveOptions.folder](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/archiveoptions/#properties) property for one of the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -239,11 +239,11 @@ with gv.Viewer("Documents.zip") as viewer: ## Specify the archive file name -When rendering an archive file, GroupDocs.Viewer displays the archive file name in the header of each page. If you need to change or hide this name, define the [ArchiveOptions.FileName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/archiveoptions/filename/) property for a target view. You can set this option to one of the following values: +When rendering an archive file, GroupDocs.Viewer displays the archive file name in the header of each page. If you need to change or hide this name, define the [archive_options.file_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/archiveoptions/#properties) property for a target view. You can set this option to one of the following values: -* [FileName.Source](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/filename/source/)--- Returns the name of the source file (this name is used by default). -* [FileName.Empty](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/archiveoptions/properties/filename/empty)---Specifies an empty name. Use this value to hide the archive file name in the output file. -* A [FileName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/filename/filename/) instance with a custom name you want to display in the output file. +* [FileName.SOURCE](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/filename/#properties)--- Returns the name of the source file (this name is used by default). +* [FileName.EMPTY](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/filename/#properties)---Specifies an empty name. Use this value to hide the archive file name in the output file. +* A [FileName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/filename/) instance with a custom name you want to display in the output file. The following code snippet demonstrates how to use a custom name when rendering an archive file to HTML: diff --git a/python-net/rendering-basics/render-cad-documents/render-cad-documents.md b/python-net/rendering-basics/render-cad-documents/render-cad-documents.md index 57da669..471d770 100644 --- a/python-net/rendering-basics/render-cad-documents/render-cad-documents.md +++ b/python-net/rendering-basics/render-cad-documents/render-cad-documents.md @@ -55,7 +55,7 @@ The `HtmlViewOptions` class properties allow you to control the conversion proce ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -76,7 +76,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and style sheets) separately, call the [HtmlViewOptions.ForExternalResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and style sheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -101,7 +101,7 @@ The image below demonstrates the result. External resources are placed in a sepa ## Render CAD drawings as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -121,7 +121,7 @@ The following image demonstrates the result: ## Render CAD drawings as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -143,7 +143,7 @@ The following image demonstrates the result: ## Render CAD drawings as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a CAD file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -164,7 +164,7 @@ with gv.Viewer("HousePlan.dwg") as viewer: Follow the steps below to obtain information about layouts and layers contained in a CAD drawing. You can use this information to specify which layers and layouts to display in the output file. 1. Create a [ViewInfoOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions) instance for a specific view. -2. Call the [Viewer.GetViewInfo](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/#methods) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [CadViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo) type. +2. Call the [Viewer.get_view_info](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/#methods) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [CadViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo) type. 3. Use the [CadViewInfo.Layouts](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo/#properties) and [CadViewInfo.Layers](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/cadviewinfo/#properties) properties to obtain the lists of layouts and layers in the CAD file. {{< tabs "example6">}} @@ -201,7 +201,7 @@ The following image shows a sample console output: ## Render all or specific layouts -When you convert a CAD drawing to HTML, PDF, or image format, GroupDocs.Viewer renders only the model-space layout (*Model*). If you also need to render all paper space layouts contained in your CAD file, enable the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) option for one of the following classes (depending on the output file format): +When you convert a CAD drawing to HTML, PDF, or image format, GroupDocs.Viewer renders only the model-space layout (*Model*). If you also need to render all paper space layouts contained in your CAD file, enable the [CadOptions.render_layouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) option for one of the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -225,7 +225,7 @@ with gv.Viewer("sample.dwg") as viewer: {{< /tab >}} {{< /tabs >}} -To render a specific layout, assign the layout name to the [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property of a target view. +To render a specific layout, assign the layout name to the [CadOptions.layout_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property of a target view. {{< tabs "example8">}} {{< tab "Python">}} @@ -243,9 +243,9 @@ with gv.Viewer("sample.dwg") as viewer: {{< /tabs >}} {{< alert style="info" >}} -1. The [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) and [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) properties apply only to the following file formats: DWG, DWT, DXF, and DWF. +1. The [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) and [CadOptions.layout_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) properties apply only to the following file formats: DWG, DWT, DXF, and DWF. -2. If you use the [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to render a specific layout, the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) option is ignored.{{< /alert >}} +2. If you use the [CadOptions.layout_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to render a specific layout, the [CadOptions.render_layouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) option is ignored.{{< /alert >}} ## Render specific layers @@ -263,7 +263,7 @@ When you convert a CAD drawing to HTML, PDF, or image format, GroupDocs.Viewer r * [PngViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pngviewoptions) * [JpgViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/jpgviewoptions) -2. Assign the list of layers you want to render to the [CadOptions.Layers](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/cadoptions/#properties) property. +2. Assign the list of layers you want to render to the [cad_options.layers](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/cadoptions/#properties) property. The following example renders layers with walls and furniture to PDF: diff --git a/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md b/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md index a4c93c9..4427f82 100644 --- a/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md +++ b/python-net/rendering-basics/render-cad-documents/specify-rendering-options.md @@ -24,7 +24,7 @@ GroupDocs.Viewer ships with the [CadOptions](https://reference.groupdocs.com/vie ## Specify the background color -Use the [CadOptions.BackgroundColor](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to specify the background color for the output file. +Use the [cad_options.background_color](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to specify the background color for the output file. The following code snippet converts a CAD drawing to PDF and sets the background color of PDF pages to light yellow: @@ -47,10 +47,10 @@ The following image illustrates the result: When rendering a CAD drawing, GroupDocs.Viewer creates an image with the largest dimension (width or height) set to 2000 pixels. The other dimension is calculated based on the aspect ratio of the original drawing. You can use the following methods to change the width and height of the output file: -* [CadOptions.ForRenderingByWidth](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image width in pixels. The image height is calculated based on the aspect ratio of the original CAD drawing. -* [CadOptions.ForRenderingByHeight](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image height in pixels. The image width is calculated based on the aspect ratio of the original CAD drawing. -* [CadOptions.ForRenderingByWidthAndHeigh](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image width and height in pixels. -* [CadOptions.ForRenderingByScaleFactor](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies a scale factor to apply to the output image. Values between 0 and 1 decrease the image size, and values greater than 1 increase the image. +* [CadOptions.for_rendering_by_width](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image width in pixels. The image height is calculated based on the aspect ratio of the original CAD drawing. +* [CadOptions.for_rendering_by_height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image height in pixels. The image width is calculated based on the aspect ratio of the original CAD drawing. +* [CadOptions.for_rendering_by_width_and_height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies the output image width and height in pixels. +* [CadOptions.for_rendering_by_scale_factor](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods)---Specifies a scale factor to apply to the output image. Values between 0 and 1 decrease the image size, and values greater than 1 increase the image. The following example converts a CAD drawing to PNG format and reduces the width and height of the output image by 50%: @@ -67,11 +67,11 @@ with gv.Viewer("HousePlan.dwg") as viewer: {{< /tab >}} {{< /tabs >}} -When you render all layouts/sheets contained in a CAD file (the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) property is `true`), each layout/sheet is rendered as a separate page/image and has its own size. In this case, when you specify only the [width](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods) or [height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods) value, the other side is scaled proportionally to maintain the aspect ratio of each layout/sheet. When you set both [width and height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods), all generated images have the same size and may look distorted. To avoid this, use the [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to render each layout/sheet separately and set its size. +When you render all layouts/sheets contained in a CAD file (the [CadOptions.render_layouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) property is `True`), each layout/sheet is rendered as a separate page/image and has its own size. In this case, when you specify only the [width](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods) or [height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods) value, the other side is scaled proportionally to maintain the aspect ratio of each layout/sheet. When you set both [width and height](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#methods), all generated images have the same size and may look distorted. To avoid this, use the [CadOptions.layout_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property to render each layout/sheet separately and set its size. ### Apply the PC3 file settings -AutoCAD allows you to configure plotter settings and save them as a PC3 file (Plotter Configuration Version 3) for later use. With GroupDocs.Viewer, you can apply width and height values from a PC3 file to the output file when you convert your CAD drawing to HTML, PDF, or image format. Use the [CadOptions.Pc3File](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property for a target view to specify a path to the PC3 file with required settings. The default location for PC3 files is "*C:\Users\\[Username]\\AppData\Roaming\Autodesk\AutoCAD [Version]\\[Version Code]\\[Language]\Plotters*". +AutoCAD allows you to configure plotter settings and save them as a PC3 file (Plotter Configuration Version 3) for later use. With GroupDocs.Viewer, you can apply width and height values from a PC3 file to the output file when you convert your CAD drawing to HTML, PDF, or image format. Use the [CadOptions.pc_3_file](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property for a target view to specify a path to the PC3 file with required settings. The default location for PC3 files is "*C:\Users\\[Username]\\AppData\Roaming\Autodesk\AutoCAD [Version]\\[Version Code]\\[Language]\Plotters*". {{< tabs "example3">}} {{< tab "Python">}} @@ -88,7 +88,7 @@ with gv.Viewer("sample.dwg") as viewer: ## Split a drawing into tiles -With GroupDocs.Viewer, you can split a CAD drawing (in DWG or DWT format) into parts (_tiles_) and render each part separately. Tiled rendering allows you to reduce memory usage when you convert large drawings to HTML, PDF, or image format. When tiled rendering is enabled, GroupDocs.Viewer renders only the model space layout (_Model_) and ignores the [CadOptions.RenderLayouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) and [CadOptions.LayoutName](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property values. +With GroupDocs.Viewer, you can split a CAD drawing (in DWG or DWT format) into parts (_tiles_) and render each part separately. Tiled rendering allows you to reduce memory usage when you convert large drawings to HTML, PDF, or image format. When tiled rendering is enabled, GroupDocs.Viewer renders only the model space layout (_Model_) and ignores the [CadOptions.render_layouts](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) and [CadOptions.layout_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions/#properties) property values. ![Split a CAD drawing into tiles](/viewer/net/images/rendering-basics/render-cad-documents/split-drawing-into-tiles.png) @@ -96,7 +96,7 @@ To create an individual tile, instantiate a [Tile](https://reference.groupdocs.c ![Tile coordinates](/viewer/net/images/rendering-basics/render-cad-documents/tile-coordinates.png) -After you create all tiles, add them to the [ViewOptions.CadOptions.Tiles](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) list and call the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert these tiles to a desired format. Each tile will be rendered as a separate page/image. +After you create all tiles, add them to the [ViewOptions.CadOptions.tiles](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/cadoptions/#properties) list and call the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert these tiles to a desired format. Each tile will be rendered as a separate page/image. The following example demonstrates how to split a CAD drawing into four tiles (2x2) of equal size: @@ -133,7 +133,7 @@ with gv.Viewer("HousePlan.dwg") as viewer: {{< /tab >}} {{< /tabs >}} -In the example above the GroupDocs.Viewer will generate four HTML files named "page_1.html", "page_2.html", "page_3.html", and "page_4.html", where each of these HTML file contains a single tile in a form of SVG vector image. The [`HtmlViewOptions.ForExternalResources()`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) static method (with all its overloads) can also be used — in such case the SVG files will not be embedded inside the output HTML files, but will be saved separately, while HTML only references them through the `A` HTML element. +In the example above the GroupDocs.Viewer will generate four HTML files named "page_1.html", "page_2.html", "page_3.html", and "page_4.html", where each of these HTML file contains a single tile in a form of SVG vector image. The [`HtmlViewOptions.for_external_resources()`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) static method (with all its overloads) can also be used — in such case the SVG files will not be embedded inside the output HTML files, but will be saved separately, while HTML only references them through the `A` HTML element. Starting from this 24.9 version the CAD tiled rendering is also supported for the PDF — in that case the GroupDocs.Viewer generates a single PDF file, where one its page represents one tile. So, if in the example above we replace the [`HtmlViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) onto the [`PdfViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/), then the GroupDocs.Viewer will produce one PDF file with four pages inside it. @@ -141,9 +141,9 @@ Starting from this 24.9 version the CAD tiled rendering is also supported for th By default the GroupDocs.Viewer converts and renders all documents within CAD format family with the max possible quality. In case when the input CAD file (DWG, for example) is very complex, it may lead to quite significant processing time. Also, the size of the generated output HTML or image (vector or raster) also may be too heavy. -Starting from this version 24.9 the GroupDocs.Viewer introduces a new public property within the [`CadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class — the `EnablePerformanceConversionMode` boolean flag. By default it is set to `false` - the GroupDocs.Viewer behaves as in previous versions, preserving the maximum quality. But when setting its value to `true`, then the performance-oriented conversion mode is enabled, which leads to significantly lesser conversion time as well as lesser byte size of the output document. +Starting from this version 24.9 the GroupDocs.Viewer introduces a new public property within the [`CadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class — the `enable_performance_conversion_mode` boolean flag. By default it is set to `False` - the GroupDocs.Viewer behaves as in previous versions, preserving the maximum quality. But when setting its value to `True`, then the performance-oriented conversion mode is enabled, which leads to significantly lesser conversion time as well as lesser byte size of the output document. -Enabling this mode is pretty simple — just create an instance of the [`CadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class by using [any of the static # described above](#ctors), and then set the value for the `EnablePerformanceConversionMode` property. Example is below: +Enabling this mode is pretty simple — just create an instance of the [`CadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/cadoptions) class by using [any of the static # described above](#ctors), and then set the value for the `enable_performance_conversion_mode` property. Example is below: {{< tabs "example5">}} diff --git a/python-net/rendering-basics/render-ebooks.md b/python-net/rendering-basics/render-ebooks.md index d9b9a33..ed735cf 100644 --- a/python-net/rendering-basics/render-ebooks.md +++ b/python-net/rendering-basics/render-ebooks.md @@ -14,7 +14,7 @@ aliases: --- [GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to render your EBooks (EPUB, MOBI) in HTML, PDF, PNG, and JPEG formats. You do not need to use any book reader to load and view EBooks within your .NET application (web or desktop). -To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a book you want to view to the class constructor. You can load the book from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the EBook to HTML, PDF, or image format. +To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a book you want to view to the class constructor. You can load the book from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the EBook to HTML, PDF, or image format. {{< button style="primary" link="https://products.groupdocs.app/viewer/ebook" >}} {{< icon "gdoc_person" >}} View EBookd online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -30,11 +30,11 @@ GroupDocs.Viewer can detect the book format automatically based on information i ## Render EBooks as HTML -Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an EBook file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an EBook file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -54,7 +54,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.ForExternalResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forexternalresources/index) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -79,7 +79,7 @@ The image below demonstrates the result. External resources are placed in a sepa ## Render EBooks as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an EBook to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an EBook to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -99,7 +99,7 @@ The following image demonstrates the result: ## Render EBooks as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an EBook to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an EBook to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -121,7 +121,7 @@ The following image demonstrates the result: ## Render EBooks as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an EBook to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an EBook to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} diff --git a/python-net/rendering-basics/render-email-messages.md b/python-net/rendering-basics/render-email-messages.md index 183196f..cabc941 100644 --- a/python-net/rendering-basics/render-email-messages.md +++ b/python-net/rendering-basics/render-email-messages.md @@ -17,7 +17,7 @@ aliases: --- [GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to render your email messages in HTML, PDF, PNG, and JPEG formats. You do not need to use third-party email clients to view the contents of email files within your .NET application (web or desktop). -To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass an email message you want to view to the class constructor. You can load the message from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the loaded message to HTML, PDF, or image format. These methods allow you to render the entire message or specific pages. +To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass an email message you want to view to the class constructor. You can load the message from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the loaded message to HTML, PDF, or image format. These methods allow you to render the entire message or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/email" >}} {{< icon "gdoc_person" >}} View email files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -35,11 +35,11 @@ GroupDocs.Viewer can detect the email file format automatically based on informa ## Render email messages as HTML -Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an email message to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and exclude specific fonts. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an email message to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and exclude specific fonts. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To embed an email message in an HTML page, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method and specify the output file name. +To embed an email message in an HTML page, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -58,7 +58,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -To save an email message to a separate folder, call the [HtmlViewOptions.ForExternalResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forexternalresources/index) method and pass the following parameters: +To save an email message to a separate folder, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -82,7 +82,7 @@ The result is shown below. External resources are placed in a separate folder. ## Render email messages as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an email message to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an email message to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -101,7 +101,7 @@ The following image demonstrates the result: ## Render email messages as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an email message to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an email message to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -123,7 +123,7 @@ The following image demonstrates the result: ## Render email messages as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an email message to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an email message to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -141,7 +141,7 @@ with gv.Viewer("sample.eml") as viewer: ## Specify rendering options -GroupDocs.Viewer supports the [EmailOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/emailoptions) class that allows you to specify different options for rendering email messages. To access these options, use the [EmailOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/emailoptions/) property for one of the following classes (depending on the output file format): +GroupDocs.Viewer supports the [EmailOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/emailoptions) class that allows you to specify different options for rendering email messages. To access these options, use the [EmailOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property for one of the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -150,7 +150,7 @@ GroupDocs.Viewer supports the [EmailOptions](https://reference.groupdocs.com/pyt ### Set the output page size -GroupDocs.Viewer allows you to specify page size for the output file when you convert an email message to HTML, PDF, or image format. Assign a [PageSize](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pagesize/) enumeration member to the [EmailOptions.PageSize](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/emailoptions/pagesize/) property to select one of the predefined page sizes (Letter, Ledger, A0, A1, A2, A3, or A4). +GroupDocs.Viewer allows you to specify page size for the output file when you convert an email message to HTML, PDF, or image format. Assign a [PageSize](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pagesize/) enumeration member to the [email_options.page_size](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/emailoptions/#properties) property to select one of the predefined page sizes (Letter, Ledger, A0, A1, A2, A3, or A4). The following example specifies page size for the output PDF file: @@ -173,7 +173,7 @@ GroupDocs.Viewer allows you to change how standard fields (such as _From_, _To_, ![Default fields in the message header](/viewer/python-net/images/rendering-basics/render-email-messages/default-message-fields.png) -Use the [EmailOptions.FieldTextMap](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/emailoptions/properties/fieldtextmap) property to specify custom field labels. Static fields of the [Field](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/field/) class allow you to access default email header fields, as shown in the example below. +Use the [EmailOptions.field_text_map](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/emailoptions/#properties) property to specify custom field labels. Static fields of the [Field](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/field/) class allow you to access default email header fields, as shown in the example below. {{< tabs "example7">}} {{< tab "Python" >}} @@ -200,10 +200,10 @@ The following image illustrates the result: When rendering email messages, GroupDocs.Viewer formats date and time information in the message header based on the system's date and time settings. If you want to change the default date and time format or specify the time zone offset, use the following properties: -* [EmailOptions.DateTimeFormat](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/emailoptions/datetimeformat/)---Allows you to define a custom date and time format. See the following topics for details: +* [email_options.date_time_format](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/emailoptions/#properties)---Allows you to define a custom date and time format. See the following topics for details: * [Standard date and time format strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings) * [Custom date and time format strings](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings) -* [EmailOptions.TimeZoneOffset](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/emailoptions/timezoneoffset/)---Specifies the hours and minutes offset from UTC. The offset is displayed with a leading sign. A plus sign (+) indicates time ahead of UTC, and a minus sign (-) indicates time behind UTC. +* [email_options.time_zone_offset](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/emailoptions/#properties)---Specifies the hours and minutes offset from UTC. The offset is displayed with a leading sign. A plus sign (+) indicates time ahead of UTC, and a minus sign (-) indicates time behind UTC. {{< tabs "example8">}} {{< tab "Python" >}} diff --git a/python-net/rendering-basics/render-images.md b/python-net/rendering-basics/render-images.md index c9db774..b4ae416 100644 --- a/python-net/rendering-basics/render-images.md +++ b/python-net/rendering-basics/render-images.md @@ -22,7 +22,7 @@ aliases: --- [GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to load images in various formats and convert them to HTML, PDF, PNG, and JPEG. Incorporate this library into your Python application (web or desktop) to build your own image viewer. -To start with the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass an image you want to view to the class constructor. You can load the image from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the image to HTML, PDF, PNG, or JPEG format. For multipage images (such as TIFF, CDR, DICOM, WebP, and so on), you can specify the pages to render. +To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass an image you want to view to the class constructor. You can load the image from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the image to HTML, PDF, PNG, or JPEG format. For multipage images (such as TIFF, CDR, DICOM, WebP, and so on), you can specify the pages to render. {{< button style="primary" link="https://products.groupdocs.app/viewer/image" >}} {{< icon "gdoc_person" >}} View image files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-Python" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -72,11 +72,11 @@ GroupDocs.Viewer supports the following image file formats: ## Render images as HTML -Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an image to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To embed an image in an HTML page, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To embed an image in an HTML page, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -95,7 +95,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -To save an image to a separate folder, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +To save an image to a separate folder, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -119,7 +119,7 @@ The result is shown below. The image is placed in a separate folder. ## Render images as PDF -Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an image to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -138,7 +138,7 @@ The following image demonstrates the result: ## Convert images to PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an image to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties)) methods to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -160,7 +160,7 @@ The following image demonstrates the result: ## Convert images to JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert an image to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an image to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -180,13 +180,13 @@ with gv.Viewer("vector-image.svg") as viewer: When you render a PSD file with custom fonts, you can specify a folder that contains necessary fonts to prevent font substitution during rendering. To do this, follow the steps below: -1. Create a [FolderFontSource](#) class instance and specify a path to the folder that stores custom fonts. Pass a [SearchOption](#) enumeration member to the class constructor to define the search scope. The following options are available: +1. Create a [FolderFontSource](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.fonts/folderfontsource/) class instance and specify a path to the folder that stores custom fonts. Pass a [SearchOption](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.fonts/folderfontsource/#properties) enumeration member to the class constructor to define the search scope. The following options are available: * `TOP_FOLDER_ONLY`---Searches for the fonts only in the current folder. * `ALL_FOLDERS`---Searches for the fonts in the current folder and its subfolders. -2. Call the [FontSettings.setFontSources](#) static method and pass the specified font source to this method as a parameter. This method allows you to specify multiple font sources. +2. Call the [FontSettings.set_font_sources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.fonts/fontsettings/#methods) static method and pass the specified font source to this method as a parameter. This method allows you to specify multiple font sources. -You can also use the [ViewOptions.setDefaultFontName](#) method to specify the default font that should be used when a particular font is not found. +You can also use the [ViewOptions.default_font_name](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/) method to specify the default font that should be used when a particular font is not found. {{< tabs "example6">}} {{< tab "Python" >}} diff --git a/python-net/rendering-basics/render-lotus-notes-files.md b/python-net/rendering-basics/render-lotus-notes-files.md index e2a6431..e9e05cf 100644 --- a/python-net/rendering-basics/render-lotus-notes-files.md +++ b/python-net/rendering-basics/render-lotus-notes-files.md @@ -16,13 +16,13 @@ aliases: --- [GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to render [Lotus Notes Storage Facility (NSF)](https://docs.fileformat.com/database/nsf/) files in HTML, PDF, PNG, and JPEG formats. Use this library to display the contents of NSF files within your .NET application (web or desktop). -To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. +To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/nsf" >}} {{< icon "gdoc_person" >}} View NSF files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} ## Render Lotus Notes database files as HTML -To convert an NSF file to HTML, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method to create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass this instance to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method. +To convert an NSF file to HTML, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method to create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass this instance to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. {{< tabs "example1">}} {{< tab "Python" >}} @@ -41,7 +41,7 @@ The following image demonstrates the result: ## Render Lotus Notes database files as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an NSF file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an NSF file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example2">}} {{< tab "Python" >}} @@ -60,7 +60,7 @@ The following image demonstrates the result: ## Render Lotus Notes database files as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an NSF file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an NSF file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example3">}} {{< tab "Python" >}} @@ -83,7 +83,7 @@ The following image demonstrates the result: ## Render Lotus Notes database files as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an NSF file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an NSF file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -102,7 +102,7 @@ with gv.Viewer("sample.nsf") as viewer: ## Specify rendering options -GroupDocs.Viewer supports the [MailStorageOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/) class that allows you to specify different options for rendering Lotus Notes database files. To access these options, use the [MailStorageOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/mailstorageoptions/) property for one of the following classes (depending on the output file format): +GroupDocs.Viewer supports the [MailStorageOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/) class that allows you to specify different options for rendering Lotus Notes database files. To access these options, use the [MailStorageOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/) property for one of the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -111,7 +111,7 @@ GroupDocs.Viewer supports the [MailStorageOptions](https://reference.groupdocs.c ### Limit the number of items to render -When you load large Lotus Notes database files, it may take a significant amount of time to retrieve and render file contents. To improve rendering performance, use the [MailStorageOptions.MaxItems](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/maxitems/) property to limit the number of rendered items. The default property value is **0** (all existing items appear in the output file). +When you load large Lotus Notes database files, it may take a significant amount of time to retrieve and render file contents. To improve rendering performance, use the [mail_storage_options.max_items](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/#properties) property to limit the number of rendered items. The default property value is **0** (all existing items appear in the output file). The following example demonstrates how to specify the maximum number of items to render: @@ -136,8 +136,8 @@ IBM Notes allows you to filter messages by specific words in the message body or With GroupDocs.Viewer, you can also filter messages before rendering a Lotus Notes database file to HTML, PDF, or image format. To do this, use the following properties: -* [MailStorageOptions.TextFilter](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/textfilter/)---Allows you to render all messages that contain specific text in the subject or body. -* [MailStorageOptions.AddressFilter](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/addressfilter/)---Allows you to render all messages that contain specific text in the sender's or recipient's address. +* [mail_storage_options.text_filter](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/)---Allows you to render all messages that contain specific text in the subject or body. +* [mail_storage_options.address_filter](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/mailstorageoptions/)---Allows you to render all messages that contain specific text in the sender's or recipient's address. The following code sample filters messages in an NSF file before rendering this file to HTML: diff --git a/python-net/rendering-basics/render-ms-project-files.md b/python-net/rendering-basics/render-ms-project-files.md index c79772b..deab62b 100644 --- a/python-net/rendering-basics/render-ms-project-files.md +++ b/python-net/rendering-basics/render-ms-project-files.md @@ -17,7 +17,7 @@ aliases: --- [GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to render Project files in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Project or other project management software to load and view Project files within your .NET application (web or desktop). -To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. +To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/project" >}} {{< icon "gdoc_person" >}} View Project files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -35,11 +35,11 @@ GroupDocs.Viewer can detect the document format automatically based on informati ## Render Project files as HTML -Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert a Project file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [[Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Project file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -59,7 +59,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.ForExternalResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forexternalresources/index) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -84,7 +84,7 @@ The image below demonstrates the result. External resources are placed in a sepa ## Render Project files as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert a Project file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [[Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Project file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -103,7 +103,7 @@ The following image demonstrates the result: ## Render Project files as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert a Project file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [[Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Project file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -126,7 +126,7 @@ The following image demonstrates the result: ## Render Project files as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert a Project file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [[Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Project file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -148,7 +148,7 @@ with gv.Viewer("SoftwareDevelopmentPlan.mpp") as viewer: Follow the steps below to obtain information about a Project file (the file format, the number of pages, the project's start and end dates): 1. Create a [ViewInfoOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions) instance for a specific view. -2. Call the [Viewer.GetViewInfo](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/methods/getviewinfo) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [ProjectManagementViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/projectmanagementviewinfo) type. +2. Call the [Viewer.get_view_info](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/#methods) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [ProjectManagementViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/projectmanagementviewinfo) type. 3. Use the `ProjectManagementViewInfo` class properties to retrieve information about the Project file. {{< tabs "example6">}} @@ -174,7 +174,7 @@ The following image shows a sample console output: ## Specify the output page size -GroupDocs.Viewer allows you to specify page size for the output file when you convert your Project document to HTML, PDF, or image format. Assign a [PageSize](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pagesize) enumeration member to the [ProjectManagementOptions.PageSize](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/projectmanagementoptions/properties/pagesize) property to select one of the predefined page sizes (Letter, Ledger, A0, A1, A2, A3, or A4). You can access this property for the following classes (depending on the output file format): +GroupDocs.Viewer allows you to specify page size for the output file when you convert your Project document to HTML, PDF, or image format. Assign a [PageSize](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pagesize) enumeration member to the [project_management_options.page_size](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/projectmanagementoptions/#properties) property to select one of the predefined page sizes (Letter, Ledger, A0, A1, A2, A3, or A4). You can access this property for the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -202,7 +202,7 @@ with gv.Viewer("SoftwareDevelopmentPlan.mpp") as viewer: ## Adjust the time unit -When rendering a Project file, GroupDocs.Viewer selects the smallest time unit on a timescale based on the total length of the project. You can adjust the timescale to show smaller or greater time units (from days to months). To do this, set the [ViewOptions.ProjectManagementOptions.TimeUnit](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/projectmanagementoptions/properties/timeunit) property for a target view to one of the following [TimeUnit](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/timeunit) enumeration members: +When rendering a Project file, GroupDocs.Viewer selects the smallest time unit on a timescale based on the total length of the project. You can adjust the timescale to show smaller or greater time units (from days to months). To do this, set the [ViewOptions.project_management_options.time_unit](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/projectmanagementoptions/#properties) property for a target view to one of the following [TimeUnit](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/timeunit) enumeration members: * `Days` displays days on the timescale. * `ThirdsOfMonths` displays the Beginning/Middle/End (B/M/E) of each month on the timescale. @@ -231,29 +231,11 @@ The image below illustrates the result. ## Render specific dates -With GroupDocs.Viewer, you can render only a portion of the project's timeline when you convert your Project file to HTML, PDF, or image format. Set the [ViewOptions.ProjectManagementOptions.StartDate](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/projectmanagementoptions/properties/startdate) and [ViewOptions.ProjectManagementOptions.EndDate](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/projectmanagementoptions/properties/enddate) properties for a target view to specify a date range the timeline should display. If you set only the `StartDate` property, the timeline displays information for tasks from the specified date to the project's finish date. If you set only the `EndDate` property, the timeline contains dates from the project's start date to the specified date. +With GroupDocs.Viewer, you can render only a portion of the project's timeline when you convert your Project file to HTML, PDF, or image format. Set the [ViewOptions.project_management_options.start_date](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/projectmanagementoptions/#properties) and [ViewOptions.project_management_options.end_date](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/projectmanagementoptions/#properties) properties for a target view to specify a date range the timeline should display. If you set only the `start_date` property, the timeline displays information for tasks from the specified date to the project's finish date. If you set only the `end_date` property, the timeline contains dates from the project's start date to the specified date. The example below demonstrates how to convert a Project file to PDF and set the timeline date range. {{< tabs "example9">}} -{{< tab "C#" >}} -```csharp -using System; -using GroupDocs.Viewer; -using GroupDocs.Viewer.Options; -// ... - -using (var viewer = new Viewer("SoftwareDevelopmentPlan.mpp")) -{ - // Convert the document to PDF. - var viewOptions = new PdfViewOptions("output.pdf"); - // Specify the date range. - viewOptions.ProjectManagementOptions.StartDate = new DateTime(2022, 08, 01); - viewOptions.ProjectManagementOptions.EndDate = new DateTime(2022, 09, 01); - viewer.View(viewOptions); -} -``` -{{< /tab >}} {{< tab "Python" >}} ```python import datetime @@ -279,7 +261,7 @@ Microsoft Project allows you to add notes to tasks, resources, and assignments. ![Speaker notes in Microsoft PowerPoint](/viewer/python-net/images/rendering-basics/render-ms-project-files/project-task-notes.png) -If you need to display these notes in the output HTML, PDF, or image files, enable the [ViewOptions.RenderNotes](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/rendernotes) property for a target view. +If you need to display these notes in the output HTML, PDF, or image files, enable the [ViewOptions.render_notes](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property for a target view. The following code sample converts a Project file with task notes to PDF: diff --git a/python-net/rendering-basics/render-outlook-data-files.md b/python-net/rendering-basics/render-outlook-data-files.md index 81174af..73aed65 100644 --- a/python-net/rendering-basics/render-outlook-data-files.md +++ b/python-net/rendering-basics/render-outlook-data-files.md @@ -19,7 +19,7 @@ aliases: --- [GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) allows you to render Microsoft Outlook data files in HTML, PDF, PNG, and JPEG formats. Use this library to display the contents of OST and PST files within your .NET application (web or desktop). -To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. +To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/outlook" >}} {{< icon "gdoc_person" >}} View Outlook files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -34,7 +34,7 @@ GroupDocs.Viewer can detect the document format automatically based on informati ## Render Outlook data files as HTML -To convert an OST or PST file to HTML, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method to create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass this instance to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method. +To convert an OST or PST file to HTML, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method to create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass this instance to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. {{< tabs "example1">}} {{< tab "Python" >}} @@ -53,7 +53,7 @@ The following image demonstrates the result: ## Render Outlook data files as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an OST or PST file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an OST or PST file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example2">}} {{< tab "Python" >}} @@ -72,7 +72,7 @@ The following image demonstrates the result: ## Render Outlook data files as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an OST or PST file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an OST or PST file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example3">}} {{< tab "Python" >}} @@ -95,7 +95,7 @@ The following image demonstrates the result: ## Render Outlook data files as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert an OST or PST file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert an OST or PST file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -114,7 +114,7 @@ with gv.Viewer("sample.pst") as viewer: ## Specify rendering options -GroupDocs.Viewer supports the [OutlookOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/outlookoptions) class that allows you to specify different options for rendering Outlook data files. To access these options, use the [OutlookOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/outlookoptions) property for one of the following classes (depending on the output file format): +GroupDocs.Viewer supports the [OutlookOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/outlookoptions) class that allows you to specify different options for rendering Outlook data files. To access these options, use the [outlook_options](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property for one of the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -123,7 +123,7 @@ GroupDocs.Viewer supports the [OutlookOptions](https://reference.groupdocs.com/v ### Render a specific folder -When you convert an OST or PST file to HTML, PDF, or image format, GroupDocs.Viewer renders messages from all folders contained in the file (including nested folders). If you want to render items from a specific folder, set the [OutlookOptions.Folder](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/properties/folder) property for a target view. Specify the folder name as follows: `{Parent folder name}\\{Subfolder name}`. +When you convert an OST or PST file to HTML, PDF, or image format, GroupDocs.Viewer renders messages from all folders contained in the file (including nested folders). If you want to render items from a specific folder, set the [outlook_options.folder](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/#properties) property for a target view. Specify the folder name as follows: `{Parent folder name}\\{Subfolder name}`. {{< tabs "example5">}} @@ -143,7 +143,7 @@ with gv.Viewer("sample.pst") as viewer: ### Limit the number of folder items to render -When you load large Outlook data files, it may take a significant amount of time to retrieve and render file contents. To improve rendering performance, use the [OutlookOptions.MaxItemsInFolder](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/properties/maxitemsinfolder) property to limit the number of rendered items (messages, contacts, or tasks) in each folder. The default property value is **50**. Set this property to **0** to render all existing items. +When you load large Outlook data files, it may take a significant amount of time to retrieve and render file contents. To improve rendering performance, use the [OutlookOptions.max_items_in_folder](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/#properties) property to limit the number of rendered items (messages, contacts, or tasks) in each folder. The default property value is **50**. Set this property to **0** to render all existing items. The following example demonstrates how to specify the maximum number of folder items to render: @@ -168,8 +168,8 @@ Microsoft Outlook allows you to filter messages by specific words in the message With GroupDocs.Viewer, you can also filter messages before rendering an Outlook data file to HTML, PDF, or image format. To do this, use the following properties: -* [OutlookOptions.TextFilter](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/properties/textfilter)---Allows you to render all messages that contain specific text in the subject or body. -* [OutlookOptions.AddressFilter](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/properties/addressfilter)---Allows you to render all messages that contain specific text in the sender's or recipient's address. +* [OutlookOptions.text_filter](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/#properties)---Allows you to render all messages that contain specific text in the subject or body. +* [OutlookOptions.address_filter](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/outlookoptions/#properties)---Allows you to render all messages that contain specific text in the sender's or recipient's address. The following code sample filters messages in a PST file before rendering this file to HTML: diff --git a/python-net/rendering-basics/render-pdf-documents.md b/python-net/rendering-basics/render-pdf-documents.md index 33bfeb0..2f1ccfc 100644 --- a/python-net/rendering-basics/render-pdf-documents.md +++ b/python-net/rendering-basics/render-pdf-documents.md @@ -14,7 +14,7 @@ aliases: --- [GroupDocs.Viewer for Python](https://products.groupdocs.com/viewer/python-net) allows you to render your PDF files in HTML, PNG, and JPEG formats. Use this library to implement a simple PDF viewer within your Python application (web or desktop). -Create a [Viewer](#) class instance to get started with the GroupDocs.Viewer API. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to HTML or image format. These methods allow you to render the entire document or specific pages. +Create a [Viewer](#) class instance to get started with the GroupDocs.Viewer API. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/pdf" >}} {{< icon "gdoc_person" >}} View PDF files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -29,11 +29,11 @@ GroupDocs.Viewer supports the following PDF and Page Layout file formats: ## Render PDF files as HTML -Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a PDF file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a PDF file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -53,7 +53,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -87,11 +87,11 @@ The following image demonstrates PDF document rendered HTML with fixed layout: ### Adjust image quality in the output HTML file -The [HtmlviewOptions.getPdfOptions().setImageQuality()](#) methods allows you to specify the quality of images in the output HTML file. You can set this property to one of the following values: +The [HtmlviewOptions.pdf_options.image_quality](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptions/#properties) methods allows you to specify the quality of images in the output HTML file. You can set this property to one of the following values: -* [ImageQuality.LOW](#) --- The image resolution is low (96 DPI), and the image size is small. Use this value to increase the conversion performance. -* [ImageQuality.MEDIUM](#) --- The image resolution is medium (192 DPI), and the image size is larger compared to the low quality images. -* [ImageQuality.HIGH](#) --- The image resolution is high (300 DPI), and the image size is big. Use of this value may decrease the conversion performance. +* [ImageQuality.LOW](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/imagequality/#members) --- The image resolution is low (96 DPI), and the image size is small. Use this value to increase the conversion performance. +* [ImageQuality.MEDIUM](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/imagequality/#members) --- The image resolution is medium (192 DPI), and the image size is larger compared to the low quality images. +* [ImageQuality.HIGH](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/imagequality/#members) --- The image resolution is high (300 DPI), and the image size is big. Use of this value may decrease the conversion performance. The following code snippet shows how to set the medium image quality when rendering a PDF document to HTML: @@ -111,7 +111,7 @@ with gv.Viewer("resume.pdf") as viewer: ### Render text as an image -GroupDocs.Viewer supports the [HtmlViewOptions.getPdfOptions().setRenderTextAsImage](#) option that allows you to render text as an image when you convert a PDF file to HTML. In this case, the layout of the output HTML file closely mirrors the layout of the source PDF document. +GroupDocs.Viewer supports the [HtmlViewOptions.pdf_options.render_text_as_image](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptions/#properties) option that allows you to render text as an image when you convert a PDF file to HTML. In this case, the layout of the output HTML file closely mirrors the layout of the source PDF document. The following code snippet shows how to enable this option in code: @@ -136,7 +136,7 @@ The image below illustrates the result. PDF content is exported to HTML as an im ### Enable multi-layer rendering -When you convert a PDF file to HTML, GroupDocs.Viewer creates an HTML document with a single layer (the `z-index` is not specified for document elements). This helps increase performance and reduce the output file size. If you convert a PDF document with multiple layers and want to improve the position of document elements in the output HTML file, use the [HtmlViewOptions.getPdfOptions().setEnableLayeredRendering](#) method to render text and graphics in the HTML file according to their z-order in the source PDF document. +When you convert a PDF file to HTML, GroupDocs.Viewer creates an HTML document with a single layer (the `z-index` is not specified for document elements). This helps increase performance and reduce the output file size. If you convert a PDF document with multiple layers and want to improve the position of document elements in the output HTML file, use the [HtmlViewOptions.pdf_options.enable_layered_rendering](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptions/#properties) method to render text and graphics in the HTML file according to their z-order in the source PDF document. The following code snippet shows how to enable the multi-layer rendering: @@ -158,7 +158,7 @@ with gv.Viewer("resume.pdf") as viewer: ### Convert PDF files to PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a PDF file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a PDF file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example7">}} {{< tab "Python" >}} @@ -181,7 +181,7 @@ The following image demonstrates the result: ### Convert PDF files to JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a PDF file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a PDF file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example8">}} {{< tab "Python" >}} @@ -200,7 +200,7 @@ with gv.Viewer("resume.pdf") as viewer: ### Preserve the size of document pages -When you render PDF documents as images, GroupDocs.Viewer calculates the optimal image size to achieve better rendering quality. If you want the generated images to be the same size as pages in the source PDF document, use the [PdfOptions.setRenderOriginalPageSize](#) method of the [PngViewOptions](#) or [JpgViewOptions](#) class (depending on the output image format). +When you render PDF documents as images, GroupDocs.Viewer calculates the optimal image size to achieve better rendering quality. If you want the generated images to be the same size as pages in the source PDF document, use the [PdfOptions.render_original_page_size](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptions/#properties) method of the [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) or [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) class (depending on the output image format). {{< tabs "example9">}} {{< tab "Python" >}} @@ -218,7 +218,7 @@ with gv.Viewer("resume.pdf") as viewer: ### Enable font hinting -To adjust the display of outline fonts when you convert PDF documents to PNG or JPEG, use the [PdfOptions.setEnableFontHinting](#) method, as shown below: +To adjust the display of outline fonts when you convert PDF documents to PNG or JPEG, use the [PdfOptions.enable_font_hinting](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptions/#properties) method, as shown below: {{< tabs "example10">}} {{< tab "Python" >}} @@ -238,7 +238,7 @@ Refer to the following article for more information on font hinting: [Font hinti ## Disable character grouping -When you render PDF files in other formats, GroupDocs.Viewer groups individual characters into words to improve rendering performance. If your document contains hieroglyphic or special symbols, you may need to disable character grouping to generate a more precise layout. To do this, use the [PdfOptions.setDisableCharsGrouping](#) method, as shown below: +When you render PDF files in other formats, GroupDocs.Viewer groups individual characters into words to improve rendering performance. If your document contains hieroglyphic or special symbols, you may need to disable character grouping to generate a more precise layout. To do this, use the [PdfOptions.disable_chars_grouping]((https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptions/#properties) method, as shown below: {{< tabs "example11">}} {{< tab "Python" >}} @@ -256,7 +256,7 @@ with gv.Viewer("resume.pdf") as viewer: ## Render text comments -Use the [ViewOptions.setRenderComments](#) method for a target view to display textual annotations (such as text comments, sticky notes, text boxes and callouts) in the output HTML, PNG, or JPEG files. +Use the [ViewOptions.render_comments](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/#properties) method for a target view to display textual annotations (such as text comments, sticky notes, text boxes and callouts) in the output HTML, PNG, or JPEG files. The code example below renders a PDF file with text comments as an image. @@ -282,8 +282,8 @@ The following image illustrates the result: Follow the steps below to obtain information about a PDF file (the number of pages, page size, and printing permissions): -1. Create a [ViewInfoOptions](#) instance for a specific view. -2. Call the [Viewer.getViewInfo](#) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [PdfViewInfo](#) type. +1. Create a [ViewInfoOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions) instance for a specific view. +2. Call the [Viewer.get_view_info](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer/#methods) method, pass the `ViewInfoOptions` instance to this method as a parameter, and cast the returned object to the [PdfViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/pdfviewinfo/) type. 3. Use the `PdfViewInfo` class properties to retrieve document-specific information. {{< tabs "example13">}} @@ -311,23 +311,35 @@ The following image shows a sample console output: ### Extract text from a PDF file -Use the [ViewInfoOptions.setExtractText](#) method to enable PDF text extraction. Use the [PdfViewInfo.getPages](#) methods to obtain the list of all document pages, and use the ([Page.getLines](#) method to retrieve text for each line. +Use the [ViewInfoOptions.extract_text](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions/#properties) method to enable PDF text extraction. Use the [PdfViewInfo.pages](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/pdfviewinfo/#properties) methods to obtain the list of all document pages, and use the [Page.lines](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/page/#properties) method to retrieve text for each line. {{< tabs "example14">}} {{< tab "Python" >}} ```python +import sys + with gv.Viewer("resume.pdf") as viewer: - viewInfoOptions = gvo.ViewInfoOptions.for_html_view() - viewInfoOptions.extract_text = True + view_info_options = gvo.ViewInfoOptions.for_html_view() + view_info_options.extract_text = True + + view_info = viewer.getViewInfo(view_info_options) + + # Retrieve text from the PDF file. + sys.stdout.reconfigure(encoding='utf-8') + + for page in view_info.pages: + print(f"Page: {page.number}") + print("Text lines/words/characters:") -viewInfo = viewer.getViewInfo(viewInfoOptions) + for line in page.lines: + text = str(line) + encoded_line = text.encode('utf-8') + sys.stdout.buffer.write(encoded_line) -// Retrieve text from the PDF file. -viewInfo.getPages().toArray().forEach(function(page) { - page.getLines().toArray().forEach(function(line){ - console.log(line.getValue()) - }) - }) + for word in line.words: + print("\t" + word.value) + for character in word.characters: + print("\t\t" + character.value) ``` {{< /tab >}} {{< /tabs >}} diff --git a/python-net/rendering-basics/render-presentations.md b/python-net/rendering-basics/render-presentations.md index 41551ca..3bb9937 100644 --- a/python-net/rendering-basics/render-presentations.md +++ b/python-net/rendering-basics/render-presentations.md @@ -18,7 +18,7 @@ aliases: --- [GroupDocs.Viewer for Python](https://products.groupdocs.com/viewer/python-net) allows you to render your presentations in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft PowerPoint or other software to load and view presentations within your Python application (web or desktop). -Create a [Viewer](#) class instance to get started with the GroupDocs.Viewer API. Pass a presentation you want to view to the class constructor. You can load the presentation from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the presentation to HTML, PDF, or image format. These methods allow you to render the entire presentation or specific slides. +Create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class instance to get started with the GroupDocs.Viewer API. Pass a presentation you want to view to the class constructor. You can load the presentation from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the presentation to HTML, PDF, or image format. These methods allow you to render the entire presentation or specific slides. {{< button style="primary" link="https://products.groupdocs.app/viewer/powerpoint" >}} {{< icon "gdoc_person" >}} View PowerPoint files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -41,11 +41,11 @@ GroupDocs.Viewer supports the following file formats: ## Render presentations as HTML -Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a presentation file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -65,7 +65,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -90,7 +90,7 @@ The image below demonstrates the result. External resources are placed in a sepa ## Render presentations as PDF -Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a presentation file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -108,7 +108,7 @@ The following image demonstrates the result: ## Render presentations as PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a presentation file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -128,7 +128,7 @@ The following image demonstrates the result: ## Render presentations as JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a presentation file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a presentation file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example5">}} @@ -147,7 +147,7 @@ with gv.Viewer("sample.pptx") as viewer: ## Render hidden slides -If your presentation contains hidden slides, use the [ViewOptions.setRenderHiddenPages](#) method for a target view to display these slides in the output HTML, PDF, or image files. +If your presentation contains hidden slides, use the [ViewOptions.render_hidden_pages](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/#properties) method for a target view to display these slides in the output HTML, PDF, or image files. The following code example uses this option to display hidden slides in the generated PDF file: @@ -164,7 +164,7 @@ with gv.Viewer("sample.pptx") as viewer: ## Render comments -Use the [ViewOptions.setRenderComments](#) method for a target view to display comments in the output file when you convert your presentation to HTML, PDF, PNG, or JPEG format. +Use the [ViewOptions.render_comments](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/#properties) method for a target view to display comments in the output file when you convert your presentation to HTML, PDF, PNG, or JPEG format. {{< tabs "example8">}} {{< tab "Python" >}} @@ -187,7 +187,7 @@ A presentation file can contain speaker notes that help presenters recall import ![Speaker notes in Microsoft PowerPoint](/viewer/python-net/images/rendering-basics/render-presentations/presentation-speaker-notes.png) -Use the [ViewOptions.setRenderNotes](#) method for a target view to display speaker notes in the output HTML, PDF, or image files. +Use the [ViewOptions.render_notes](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/#properties) method for a target view to display speaker notes in the output HTML, PDF, or image files. The following code sample renders a presentation with speaker notes to PDF: diff --git a/python-net/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md b/python-net/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md index 04f568c..82be242 100644 --- a/python-net/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md +++ b/python-net/rendering-basics/render-spreadsheets/render-excel-and-apple-numbers-spreadsheets.md @@ -18,7 +18,7 @@ aliases: --- [GroupDocs.Viewer for Python](https://products.groupdocs.com/viewer/python-net) allows you to render your spreadsheet files in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Excel or other spreadsheet programs to load and view Excel documents within your Python application (web or desktop). -To start with the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a spreadsheet file you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. +To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a spreadsheet file you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/excel" >}} {{< icon "gdoc_person" >}} View Excel files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -45,11 +45,11 @@ GroupDocs.Viewer supports the following spreadsheet file formats: ## Render spreadsheets as HTML -Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a spreadsheet file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. #### Convert an Excel workbook to HTML @@ -89,7 +89,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -132,7 +132,7 @@ The image below demonstrates the result. External resources are placed in a sepa ### Convert all Excel worksheets to one HTML file -To convert all worksheets to one HTML file, use the [HtmlViewOptions.setRenderToSinglePage](#) method. This feature is supported in both cases - when converting to HTML with embedded and external resources. +To convert all worksheets to one HTML file, use the [HtmlViewOptions.render_to_single_page](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method. This feature is supported in both cases - when converting to HTML with embedded and external resources. {{< tabs "example5">}} {{< tab "Python" >}} @@ -154,7 +154,7 @@ The following image demonstrates the result: ## Render spreadsheets as PDF -Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a spreadsheet file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). ### Convert an Excel workbook to PDF @@ -192,7 +192,7 @@ The following image demonstrates the result: ## Render spreadsheets as PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a spreadsheet file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#methods) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#methods) methods to specify the output image size in pixels. ### Convert an Excel workbook to PNG @@ -237,7 +237,7 @@ The following image demonstrates the result: ## Render spreadsheets as JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a spreadsheet file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a spreadsheet file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#methods) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#methods) methods to specify the output image size in pixels. ### Convert an Excel workbook to JPEG @@ -275,7 +275,7 @@ with gv.Viewer("Products.numbers") as viewer: ## Detect a CSV/TSV separator -If you load a CSV/TSV file to convert it to another format, use the [SpreadsheetOptions.setDetectSeparator](#) method for a target view to automatically detect a delimiter used to separate values in the source file. +If you load a CSV/TSV file to convert it to another format, use the [SpreadsheetOptions.detect_separator](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/#properties) method for a target view to automatically detect a delimiter used to separate values in the source file. GroupDocs.Viewer can detect the following separators: @@ -290,7 +290,7 @@ with gv.Viewer("sample.csv") as viewer: # {0} is replaced with the current page number in the file names. viewOptions = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html") # Detect a CSV/TSV separator. - viewOptions.spreadsheet_options.set_detect_separator = True + viewOptions.spreadsheet_options.detect_separator = True viewer.view(viewOptions) ``` {{< /tab >}} @@ -300,9 +300,9 @@ with gv.Viewer("sample.csv") as viewer: GroupDocs.Viewer allows you to obtain information about the source spreadsheet file. For example, you can retrieve worksheet names, as described below: -1. Create a [ViewInfoOptions](#) instance for a specific view. -2. Call the [Viewer.getViewInfo](#) method and pass the `ViewInfoOptions` instance to this method as a parameter. -3. Use the [getPages](#) method of the returned [ViewInfo](#) object to access to the list of worksheets and retrieve the worksheet names. +1. Create a [ViewInfoOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions/) instance for a specific view. +2. Call the [Viewer.get_view_info](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method and pass the `ViewInfoOptions` instance to this method as a parameter. +3. Use the [pages](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/viewinfo/#properties) method of the returned [ViewInfo](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/viewinfo/) object to access to the list of worksheets and retrieve the worksheet names. {{< tabs "example13">}} {{< tab "Python" >}} diff --git a/python-net/rendering-basics/render-spreadsheets/specify-rendering-options.md b/python-net/rendering-basics/render-spreadsheets/specify-rendering-options.md index f6ccf97..4e21780 100644 --- a/python-net/rendering-basics/render-spreadsheets/specify-rendering-options.md +++ b/python-net/rendering-basics/render-spreadsheets/specify-rendering-options.md @@ -17,7 +17,7 @@ aliases: - /viewer/python-net/skip-rendering-of-empty-columns/ - /viewer/python-net/skip-rendering-of-empty-rows/ --- -GroupDocs.Viewer ships with the [SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions) class that allows you to specify different spreadsheet rendering options (for example, you can display row and column headings in the output file, render grid lines, or adjust cell text overflow). To access these options, use the [SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/spreadsheetoptions) property for one of the following classes (depending on the output file format): +GroupDocs.Viewer ships with the [SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions) class that allows you to specify different spreadsheet rendering options (for example, you can display row and column headings in the output file, render grid lines, or adjust cell text overflow). To access these options, use the [SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties/) property for one of the following classes (depending on the output file format): * [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) * [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) @@ -30,7 +30,7 @@ Rows and columns in a worksheet have unique names displayed on the worksheet's l ![Row and column headings in a worksheet](/viewer/python-net/images/rendering-basics/render-spreadsheets/excel-row-and-column-headings.png) -Enable the [SpreadsheetOptions.RenderHeadings](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/renderheadings) property to display row and column headings in the output file when you render your spreadsheet in HTML, PDF, PNG, or JPEG format. +Enable the [SpreadsheetOptions.render_headings](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/renderheadings) property to display row and column headings in the output file when you render your spreadsheet in HTML, PDF, PNG, or JPEG format. The following example demonstrates how to convert an Excel workbook to PDF and display row and column headings in the output PDF file: @@ -53,7 +53,7 @@ The following image demonstrates the result: ## Render worksheet gridlines -Use the [SpreadsheetOptions.RenderGridLines](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/rendergridlines) property to display gridlines (lines that separate worksheet rows and columns) in the output file. +Use the [SpreadsheetOptions.render_grid_lines](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/rendergridlines) property to display gridlines (lines that separate worksheet rows and columns) in the output file. The following code example demonstrates how to convert an Excel workbook to PDF and display gridlines in the output PDF file: @@ -76,27 +76,27 @@ The following image demonstrates the result: ## Control cell text overflow -The [SpreadsheetOptions.TextOverflowMode](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/textoverflowmode) option allows you to prevent text overflow in worksheet cells (see the image below) when you convert your spreadsheet file to HTML, PDF, or image format. +The [SpreadsheetOptions.text_overflow_mode](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/textoverflowmode) option allows you to prevent text overflow in worksheet cells (see the image below) when you convert your spreadsheet file to HTML, PDF, or image format. ![Text overflow in a cell](/viewer/python-net/images/rendering-basics/render-spreadsheets/excel-text-overflow.png) -You can set the [TextOverflowMode](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/textoverflowmode) property to one of the following values: +You can set the [text_overflow_mode](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/#properties) property to one of the following values: -* [TextOverflowMode.OverlayIfNextIsEmpty](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) (default) --- Allows text to overflow into adjacent cells if these cells have no data. If adjacent cells are not empty, the overflowing text is truncated. +* [TextOverflowMode.OVERLAY_IF_NEXT_IS_EMPTY](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) (default) --- Allows text to overflow into adjacent cells if these cells have no data. If adjacent cells are not empty, the overflowing text is truncated. - ![TextOverflowMode.OverlayIfNextIsEmpty](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-overlay-if-empty.png) + ![TextOverflowMode.OVERLAY_IF_NEXT_IS_EMPTY](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-overlay-if-empty.png) -* [TextOverflowMode.Overlay](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) --- Text always overflows into adjacent cells even if these cells contain data. +* [TextOverflowMode.OVERLAY](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) --- Text always overflows into adjacent cells even if these cells contain data. - ![TextOverflowMode.Overlay](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-overlay.png) + ![TextOverflowMode.OVERLAY](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-overlay.png) -* [TextOverflowMode.AutoFitColumn](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) --- Increases the column width to fit cell text. +* [TextOverflowMode.AUTO_FIT_COLUMN](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) --- Increases the column width to fit cell text. - ![TextOverflowMode.AutoFitColum](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-autofit-column.png) + ![TextOverflowMode.AUTO_FIT_COLUMN](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-autofit-column.png) -* [TextOverflowMode.HideText](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) --- Hides text that overflows the cell boundaries. +* [TextOverflowMode.HIDE_TEXT](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/textoverflowmode) --- Hides text that overflows the cell boundaries. - ![TextOverflowMode.HideText](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-hide-text.png) + ![TextOverflowMode.HIDE_TEXT](/viewer/python-net/images/rendering-basics/render-spreadsheets/text-overflow-mode-hide-text.png) The following example demonstrates how to set this option in code: @@ -106,8 +106,8 @@ The following example demonstrates how to set this option in code: with gv.Viewer("invoice.xlsx") as viewer: # Convert the spreadsheet to PDF. viewOptions = gvo.PdfViewOptions("output.pdf") - # Specify the AutoFitColumn mode. - viewOptions.spreadsheet_options.text_overflow_mode = gvo.TextOverflowMode.AutoFitColumn + # Specify the AUTO_FIT_COLUMN mode. + viewOptions.spreadsheet_options.text_overflow_mode = gvo.TextOverflowMode.AUTO_FIT_COLUMN viewer.view(viewOptions) ``` {{< /tab >}} @@ -115,7 +115,7 @@ with gv.Viewer("invoice.xlsx") as viewer: ## Render hidden rows and columns -Use the [ViewOptions.SpreadsheetOptions.RenderHiddenRows](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/renderhiddenrows) and [ViewOptions.SpreadsheetOptions.RenderHiddenColumns](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/renderhiddencolumns) properties to display hidden rows and columns in the output file when you render your spreadsheet in HTML, PDF, PNG, or JPEG format. +Use the [ViewOptions.SpreadsheetOptions.render_hidden_rows](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/renderhiddenrows) and [ViewOptions.SpreadsheetOptions.render_hidden_columns](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/renderhiddencolumns) properties to display hidden rows and columns in the output file when you render your spreadsheet in HTML, PDF, PNG, or JPEG format. The example below demonstrates how to set this option in code. The rows **20** and **21** and the column **E** are hidden in the source Excel workbook. @@ -141,7 +141,7 @@ The image below demonstrates the result. Hidden rows and columns appear in the g ## Render hidden worksheets -If your spreadsheet file contains hidden worksheets, enable the [ViewOptions.RenderHiddenPages](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/renderhiddenpages) property to display data from hidden worksheets in the output HTML, PDF, or image files. +If your spreadsheet file contains hidden worksheets, enable the [ViewOptions.render_hidden_pages](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/renderhiddenpages) property to display data from hidden worksheets in the output HTML, PDF, or image files. The following example demonstrates how to set this option in code: @@ -160,7 +160,7 @@ with gv.Viewer("invoice.xlsx") as viewer: ## Skip empty rows and columns -GroupDocs.Viewer supports the [SpreadsheetOptions.SkipEmptyRows](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/skipemptyrows) and [SpreadsheetOptions.SkipEmptyColumns](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/skipemptycolumns) properties that allow you to skip blank rows and columns when you convert your spreadsheet file to HTML, PDF, or image format. +GroupDocs.Viewer supports the [SpreadsheetOptions.skip_empty_rows](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/skipemptyrows) and [SpreadsheetOptions.skip_empty_columns](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/properties/skipemptycolumns) properties that allow you to skip blank rows and columns when you convert your spreadsheet file to HTML, PDF, or image format. {{< tabs "example6">}} {{< tab "Python" >}} @@ -182,7 +182,7 @@ The following image demonstrates the result: ## Render cell comments -Use the [ViewOptions.RenderComments](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/rendercomments) option to display cell comments in the output file when you render your spreadsheet in HTML, PDF, PNG, or JPEG format. +Use the [ViewOptions.render_comments](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/rendercomments) option to display cell comments in the output file when you render your spreadsheet in HTML, PDF, PNG, or JPEG format. {{< tabs "example7">}} {{< tab "Python" >}} @@ -204,7 +204,7 @@ The following image demonstrates the result: ## Set worksheet margins in the output pdf pages -Use the [SpreadsheetOptions.RenderGridLines](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/rendergridlines) properties to set margins for worksheets in the output pdf. If margins are set to value less than 0 or not set then default value will be used. +Use the [SpreadsheetOptions.render_grid_lines](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/spreadsheetoptions/properties/rendergridlines) properties to set margins for worksheets in the output pdf. If margins are set to value less than 0 or not set then default value will be used. The following code example demonstrates how to convert an Excel workbook to PDF and set optional margins for worksheets in the output PDF file: diff --git a/python-net/rendering-basics/render-spreadsheets/split-worksheet-into-pages.md b/python-net/rendering-basics/render-spreadsheets/split-worksheet-into-pages.md index 597956c..7dddb4e 100644 --- a/python-net/rendering-basics/render-spreadsheets/split-worksheet-into-pages.md +++ b/python-net/rendering-basics/render-spreadsheets/split-worksheet-into-pages.md @@ -20,7 +20,7 @@ In the image below, the vertical page break is inserted after the column **E**, ![Preview page breaks in Microsoft Excel](/viewer/python-net/images/rendering-basics/render-spreadsheets/excel-page-break-preview.png) -To render a worksheet based on the inserted page breaks, call the [SpreadsheetOptions.ForRenderingByPageBreaks](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/methods/forrenderingbypagebreaks) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/spreadsheetoptions) property of your view (depending on the output file format). +To render a worksheet based on the inserted page breaks, call the [SpreadsheetOptions.for_rendering_by_page_breaks](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/#methods) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.spreadsheet_options](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property of your view (depending on the output file format). The following example converts a worksheet to PDF and uses the page breaks to split this worksheet into pages: @@ -94,7 +94,7 @@ In Microsoft Excel, you can designate one or more cell ranges in a worksheet as ![Specify a print area in Microsoft Excel](/viewer/python-net/images/rendering-basics/render-spreadsheets/excel-set-print-area.png) -GroupDocs.Viewer also supports this option. Call the [SpreadsheetOptions.ForRenderingPrintArea](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/methods/forrenderingprintarea) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/spreadsheetoptions) property to display only the worksheet's print area in the output HTML, PDF, or image file. +GroupDocs.Viewer also supports this option. Call the [SpreadsheetOptions.for_rendering_print_area](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/#methods) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.spreadsheet_options](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property to display only the worksheet's print area in the output HTML, PDF, or image file. The following example renders the print area displayed in the image above to PDF: @@ -117,7 +117,7 @@ The image below illustrates the result. ## Render a worksheet on one page -If you want to display all worksheet data on one page, call the [SpreadsheetOptions.ForOnePagePerSheet](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/foronepagepersheet/) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/spreadsheetoptions) property for a target view. +If you want to display all worksheet data on one page, call the [SpreadsheetOptions.for_one_page_per_sheet](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/#methods) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.spreadsheet_options](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) property for a target view. The following example converts each worksheet to one page in the PDF file: @@ -148,7 +148,7 @@ When printing, Microsoft Excel splits a worksheet into pages using both page bre ![Specify page breaks and a print area in Microsoft Excel](/viewer/python-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/python-net/groupdocs.viewer.options/spreadsheetoptions/methods/forrenderingprintareaandpagebreaks) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.SpreadsheetOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/properties/spreadsheetoptions) property to display only the worksheet's print area in the output HTML, PDF, or image file. +GroupDocs.Viewer also supports this option. Call the [SpreadsheetOptions.for_rendering_print_area_and_page_breaks](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/spreadsheetoptions/#methods) static method and assign the returned `SpreadsheetOptions` instance to the [ViewOptions.spreadsheet_options](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/baseviewoptions/#properties) 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: diff --git a/python-net/rendering-basics/render-text-files.md b/python-net/rendering-basics/render-text-files.md index f4604a3..cb30126 100644 --- a/python-net/rendering-basics/render-text-files.md +++ b/python-net/rendering-basics/render-text-files.md @@ -16,7 +16,7 @@ aliases: --- [GroupDocs.Viewer for Python](https://products.groupdocs.com/viewer/python-net) allows you to convert text documents to HTML, PDF, PNG, and JPEG formats so you can view document content in a web browser, PDF or image viewer application. -To start with the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a text document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the image to HTML, PDF, PNG, or JPEG format. These methods allow you to render the entire document or specific pages. +To start with the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class instance. Pass a text document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the image to HTML, PDF, PNG, or JPEG format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/total" >}} {{< icon "gdoc_person" >}} View text files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -69,7 +69,7 @@ GroupDocs.Viewer supports the following text and programming file formats: * [.XML (XML File)](https://docs.fileformat.com/web/xml/) * [.YAML (YAML Document)](https://docs.fileformat.com/programming/yaml/) -When you load a text document from a file, you should explicitly specify their format. To do this, create a [LoadOptions](#) class instance and use the [FileType](#) method. Then pass this instance to the [Viewer](#) class constructor. +When you load a text document from a file, you should explicitly specify their format. To do this, create a [LoadOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/loadoptions/) class instance and use the [FileType](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/filetype/) method. Then pass this instance to the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class constructor. {{< tabs "example1">}} {{< tab "Python" >}} @@ -86,11 +86,11 @@ with gv.Viewer("TermsOfService.txt", load_options) as viewer: ## Render text files as HTML -Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a text file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create HTML files with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example3">}} {{< tab "Python" >}} @@ -110,7 +110,7 @@ The following image demonstrates the result: ### Create HTML files with external resources -If you want to store output HTML files and additional resource files (such as fonts, images, and style sheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +If you want to store output HTML files and additional resource files (such as fonts, images, and style sheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -152,7 +152,7 @@ with gv.Viewer("TermsOfService.txt") as viewer: ## Render text files as PDF -Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a text file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example6">}} {{< tab "Python" >}} @@ -171,7 +171,7 @@ The following image demonstrates the result: ## Render text files as PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a text file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example7">}} {{< tab "Python" >}} @@ -194,7 +194,7 @@ The following image demonstrates the result: ## Render text files as JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a text file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a text file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example8">}} {{< tab "Python" >}} diff --git a/python-net/rendering-basics/render-visio-documents.md b/python-net/rendering-basics/render-visio-documents.md index 6485e98..6f17c1b 100644 --- a/python-net/rendering-basics/render-visio-documents.md +++ b/python-net/rendering-basics/render-visio-documents.md @@ -15,7 +15,7 @@ aliases: --- [GroupDocs.Viewer for Python via .Net](https://products.groupdocs.com/viewer/python-net) allows you to render your Visio diagrams in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Visio or other diagramming software to load and view Visio files within your .Net application (web or desktop). -To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. +To start using the GroupDocs.Viewer API, create a [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/visio" >}} {{< icon "gdoc_person" >}} View Visio files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.Net" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -43,11 +43,11 @@ GroupDocs.Viewer can detect the document format automatically based on informati ## Render Visio files as HTML -Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/methods/view/index) method to convert a Visio file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Visio file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.ForEmbeddedResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forembeddedresources/index) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -55,7 +55,7 @@ To save all elements of an HTML page (including text, graphics, and stylesheets) with gv.Viewer("flowchart.vsdx") as viewer: # Create an HTML file for each drawing page. # {0} is replaced with the current page number in the file name. - viewOptions = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html") + viewOptions = gvo.htmlViewOptions.for_embedded_resources("page_{0}.html") viewer.view(viewOptions) ``` @@ -64,11 +64,11 @@ with gv.Viewer("flowchart.vsdx") as viewer: The following image demonstrates the result: -![Render a Visio file to HTML](/viewer/python-net/images/rendering-basics/render-visio-documents/render-visio-to-html-embedded-resources.png) +![Render a Visio file to HTML](/viewer/net/images/rendering-basics/render-visio-documents/render-visio-to-html-embedded-resources.png) ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.ForExternalResources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/methods/forexternalresources/index) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -81,7 +81,7 @@ with gv.Viewer("flowchart.vsdx") as viewer: # Create an HTML file for each drawing page. # Specify the HTML file names and location of external resources. # {0} and {1} are replaced with the current page number and resource name, respectively. - viewOptions = gvo.HtmlViewOptions.for_external_resources( + viewOptions = gvo.htmlViewOptions.for_external_resources( "page_{0}.html", "page_{0}/resource_{0}_{1}", "page_{0}/resource_{0}_{1}") viewer.view(viewOptions) @@ -95,7 +95,7 @@ The image below demonstrates the result. External resources are placed in a sepa ## Render Visio files as PDF -Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/viewer/methods/view/index) method to convert a Visio file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Visio file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -116,7 +116,7 @@ The following image demonstrates the result: ## Render Visio files as PNG -Create a [PngViewOptions](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/viewer/methods/view/index) method to convert a Visio file to PNG. Use the [PngViewOptions.Height](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pngviewoptions/properties/height) and [PngViewOptions.Width](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/pngviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Visio file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -139,7 +139,7 @@ The following image demonstrates the result: ## Render Visio files as JPEG -Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.View](https://reference.groupdocs.com/viewer/net/groupdocs.viewer/viewer/methods/view/index) method to convert a Visio file to JPEG. Use the [JpgViewOptions.Height](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/jpgviewoptions/properties/height) and [JpgViewOptions.Width](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/jpgviewoptions/properties/width) properties to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Visio file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) properties to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -163,14 +163,14 @@ GroupDocs.Viewer allows you to render shapes used in a Visio diagram or stored i ![Document Stencil pane in Visio](/viewer/net/images/rendering-basics/render-visio-documents/visio-document-stencil.png) -To render only master shapes contained in Visio file, enable the [VisioRenderingOptions.RenderFiguresOnly](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/visiorenderingoptions/properties/renderfiguresonly) property for one of the following classes (depending on the output file format): +To render only master shapes contained in Visio file, enable the [VisioRenderingOptions.render_figures_only](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/visiorenderingoptions/#properties) property for one of the following classes (depending on the output file format): -* [HtmlViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/htmlviewoptions) -* [PdfViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/pdfviewoptions) -* [PngViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/pngviewoptions) -* [JpgViewOptions](https://reference.groupdocs.com/net/viewer/groupdocs.viewer.options/jpgviewoptions) +* [HtmlViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/htmlviewoptions) +* [PdfViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pdfviewoptions) +* [PngViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/pngviewoptions) +* [JpgViewOptions](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer.options/jpgviewoptions) -The [VisioRenderingOptions.FigureWidth](https://reference.groupdocs.com/viewer/net/groupdocs.viewer.options/visiorenderingoptions/properties/figurewidth) property allows you to specify the shape width in pixels. The height is calculated automatically based on the aspect ratio of each shape. +The [VisioRenderingOptions.figure_width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/visiorenderingoptions/#properties) property allows you to specify the shape width in pixels. The height is calculated automatically based on the aspect ratio of each shape. {{< tabs "example6">}} {{< tab "Python" >}} diff --git a/python-net/rendering-basics/render-web-documents.md b/python-net/rendering-basics/render-web-documents.md index 05eaeb0..960a2a3 100644 --- a/python-net/rendering-basics/render-web-documents.md +++ b/python-net/rendering-basics/render-web-documents.md @@ -16,7 +16,7 @@ aliases: --- [GroupDocs.Viewer for Python](https://products.groupdocs.com/viewer/python-net) allows you to render web documents as PDF, PNG, and JPEG files. Use this library to view web files within your Java application. -To start using the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a web document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to PDF or image format. These methods allow you to render the entire document or specific pages. +To start using the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a web document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to PDF or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/web" >}} {{< icon "gdoc_person" >}} View web files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -31,7 +31,7 @@ GroupDocs.Viewer supports the following web file formats: ## Render web documents as PDF -Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a web file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a web file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example1">}} {{< tab "Python" >}} @@ -51,7 +51,7 @@ The following image demonstrates the result: ## Render web documents as PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a web file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a web file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example2">}} {{< tab "Python" >}} @@ -74,7 +74,7 @@ The following image demonstrates the result: ## Render web documents as JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a web file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a web file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example3">}} {{< tab "Python" >}} @@ -93,11 +93,11 @@ with gv.Viewer("groupdocs-documentation.mhtml") as viewer: ## Convert CHM files to HTML -[CHM](https://docs.fileformat.com/web/chm/) is a Microsoft proprietary online help format that is often used for software documentation. With GroupDocs.Viewer, you can convert a CHM file to HTML to display this file in a web browser. To do this, create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +[CHM](https://docs.fileformat.com/web/chm/) is a Microsoft proprietary online help format that is often used for software documentation. With GroupDocs.Viewer, you can convert a CHM file to HTML to display this file in a web browser. To do this, create an [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example4">}} {{< tab "Python" >}} @@ -119,7 +119,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources diff --git a/python-net/rendering-basics/render-word-documents.md b/python-net/rendering-basics/render-word-documents.md index beaf542..d0b9466 100644 --- a/python-net/rendering-basics/render-word-documents.md +++ b/python-net/rendering-basics/render-word-documents.md @@ -15,7 +15,7 @@ aliases: --- [GroupDocs.Viewer for Python](https://products.groupdocs.com/viewer/python-net) allows you to render your Microsoft Word documents in HTML, PDF, PNG, and JPEG formats. You do not need to use Microsoft Word or other word processors to load and view Word documents within your Python application (web or desktop). -To start using the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](#) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. +To start using the GroupDocs.Viewer API, create a [Viewer](#) class instance. Pass a document you want to view to the class constructor. You can load the document from a file or stream. Call one of the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method overloads to convert the document to HTML, PDF, or image format. These methods allow you to render the entire document or specific pages. {{< button style="primary" link="https://products.groupdocs.app/viewer/word" >}} {{< icon "gdoc_person" >}} View Word files online {{< /button >}} {{< button style="primary" link="https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Python-via-.NET" >}} {{< icon "gdoc_github" >}} View demos and examples on GitHub {{< /button >}} @@ -36,11 +36,11 @@ GroupDocs.Viewer supports the following Word Processing file formats: ## Render Word documents as HTML -Create an [HtmlViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). +Create an [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Word file to HTML. The `HtmlViewOptions` class properties allow you to control the conversion process. For instance, you can embed all external resources in the generated HTML file, minify the output file, and optimize it for printing. Refer to the following documentation section for details: [Rendering to HTML]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-html/_index.md" >}}). ### Create an HTML file with embedded resources -To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.forEmbeddedResources](#) method and specify the output file name. +To save all elements of an HTML page (including text, graphics, and stylesheets) into a single file, call the [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and specify the output file name. {{< tabs "example1">}} {{< tab "Python" >}} @@ -60,7 +60,7 @@ The following image demonstrates the result: ### Create an HTML file with external resources -If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.forExternalResources](#) method and pass the following parameters: +If you want to store an HTML file and additional resource files (such as fonts, images, and stylesheets) separately, call the [HtmlViewOptions.for_external_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) method and pass the following parameters: * The output file path format * The path format for the folder with external resources @@ -85,7 +85,7 @@ The image below demonstrates the result. External resources are placed in a sepa ## Render Word documents as PDF -Create a [PdfViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). +Create a [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Word file to PDF. The `PdfViewOptions` class properties allow you to control the conversion process. For instance, you can protect the output PDF file, reorder its pages, and specify the quality of document images. Refer to the following documentation section for details: [Rendering to PDF]({{< ref "viewer/python-net/developer-guide/rendering-documents/rendering-to-pdf/_index.md" >}}). {{< tabs "example3">}} {{< tab "Python" >}} @@ -105,7 +105,7 @@ The following image demonstrates the result: ## Render Word documents as PNG -Create a [PngViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to PNG. Use the [PngViewOptions.setHeight](#) and [PngViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Word file to PNG. Use the [PngViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) and [PngViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example4">}} {{< tab "Python" >}} @@ -124,7 +124,7 @@ The following image demonstrates the result: ## Render Word documents as JPEG -Create a [JpgViewOptions](#) class instance and pass it to the [Viewer.view](#) method to convert a Word file to JPEG. Use the [JpgViewOptions.setHeight](#) and [JpgViewOptions.setWidth](#) methods to specify the output image size in pixels. +Create a [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) class instance and pass it to the [Viewer.view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method to convert a Word file to JPEG. Use the [JpgViewOptions.height](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) and [JpgViewOptions.width](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) methods to specify the output image size in pixels. {{< tabs "example5">}} {{< tab "Python" >}} @@ -142,17 +142,17 @@ with gv.Viewer("resume.docx") as viewer: Use the following methods to specify the size of page margins in the output files when you convert your Word documents to HTML, PDF, and image formats: -* [WordProcessingOptions.setTopMargin](#) specifies the distance (in points) between document content and the top edge of the page. -* [WordProcessingOptions.setBottomMargin](#) specifies the distance (in points) between document content and the bottom edge of the page. -* [WordProcessingOptions.setLeftMargin](#) specifies the distance (in points) between document content and the left edge of the page. -* [WordProcessingOptions.setRightMargin](#) specifies the distance (in points) between document content and the right edge of the page. +* [WordProcessingOptions.top_margin](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/wordprocessingoptions/#properties) specifies the distance (in points) between document content and the top edge of the page. +* [WordProcessingOptions.bottom_margin](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/wordprocessingoptions/#properties) specifies the distance (in points) between document content and the bottom edge of the page. +* [WordProcessingOptions.left_margin](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/wordprocessingoptions/#properties) specifies the distance (in points) between document content and the left edge of the page. +* [WordProcessingOptions.right_margin](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/wordprocessingoptions/#properties) specifies the distance (in points) between document content and the right edge of the page. You can access these methods for the following classes: -* [HtmlViewOptions](#) -* [PdfViewOptions](#) -* [PngViewOptions](#) -* [JpgViewOptions](#) +* [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) +* [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) +* [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) +* [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) The example below converts a Word document to HTML and specifies page margins for the output file. @@ -175,12 +175,12 @@ with gv.Viewer("resume.docx") as viewer: ## Render tracked changes -GroupDocs.Viewer does not render tracked changes (revisions made to a Word document) by default. If you want to display tracked changes in the output file, use the [WordProcessingOptions.setRenderTrackedChanges](#) method for one of the following classes (depending on the output file format): +GroupDocs.Viewer does not render tracked changes (revisions made to a Word document) by default. If you want to display tracked changes in the output file, use the [WordProcessingOptions.render_tracked_changes](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/wordprocessingoptions/#properties) method for one of the following classes (depending on the output file format): -* [HtmlViewOptions](#) -* [PdfViewOptions](#) -* [PngViewOptions](#) -* [JpgViewOptions](#) +* [HtmlViewOptions.for_embedded_resources](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) +* [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) +* [PngViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) +* [JpgViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) The following code example demonstrates how to render a Word document with tracked changes: @@ -203,7 +203,7 @@ The following image illustrates the result: ## Render comments -Use the [ViewOptions.setRenderComments](#) method for a target view to display comments in the output file when you convert your document to HTML, PDF, PNG, or JPEG format. +Use the [ViewOptions.render_comments](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewoptions/#properties) method for a target view to display comments in the output file when you convert your document to HTML, PDF, PNG, or JPEG format. The code example below renders a Word document with comments to PDF. From 9cf94ca792af85fbd6fd91363114f2aeccb799a2 Mon Sep 17 00:00:00 2001 From: Rakhim Aimaganbetov Date: Thu, 26 Sep 2024 17:12:41 +0500 Subject: [PATCH 3/4] Remove font install section from troubleshooting --- python-net/getting-started/troubleshooting/_index.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/python-net/getting-started/troubleshooting/_index.md b/python-net/getting-started/troubleshooting/_index.md index 5532ec3..691555d 100644 --- a/python-net/getting-started/troubleshooting/_index.md +++ b/python-net/getting-started/troubleshooting/_index.md @@ -10,10 +10,6 @@ hideChildren: False --- This section describes issues that you may face processing files with GroupDocs.Viewer and solutions for them. The [Known issues]({{< ref "known-issues" >}}) subsection describes the limitations known. -## On Linux, Chinese characters are garbled or rendered as boxes - -The usual cause is the language support is not installed, and there are no fonts to display the characters correctly. Please install the Asian language support as described in the articles listed below. - ## Related articles For details, please refer to the following pages: From 18df9df5107d471633161ab5139c63398977eca6 Mon Sep 17 00:00:00 2001 From: Rakhim Aimaganbetov Date: Thu, 26 Sep 2024 20:46:55 +0500 Subject: [PATCH 4/4] PdfOptimizationOptions and XML document rendering articles were implemented. --- .../adjust-jpeg-images-quality.md | 40 ++++ .../optimization-pdf-options/_index.md | 21 ++ .../optimization-pdf-for-web.md | 28 +++ .../optimization-pdf-resources.md | 28 +++ .../optimization-pdf-spreadsheets.md | 32 +++ .../optimize-content/_index.md | 11 + .../optimization-pdf-remove-annotations.md | 35 +++ .../optimization-pdf-remove-fields.md | 35 +++ .../optimize-fonts/_index.md | 11 + .../optimization-pdf-subset-fonts.md | 39 ++++ .../optimize-images/_index.md | 11 + .../optimization-pdf-convert-grayscale.md | 35 +++ .../optimization-pdf-reduce-image-quality.md | 39 ++++ .../optimization-pdf-set-max-resolution.md | 38 ++++ .../pdf-remove-unused-resources.md | 50 +++++ .../rendering-to-pdf/protect-pdf-document.md | 47 ++++ .../rendering-to-pdf/reorder-pages.md | 31 +++ ...image-size-limits-when-rendering-to-pdf.md | 78 +++++++ .../supported-document-formats.md | 9 +- .../rendering-basics/render-xml-documents.md | 205 ++++++++++++++++++ 20 files changed, 821 insertions(+), 2 deletions(-) create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/adjust-jpeg-images-quality.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-reduce-image-quality.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-set-max-resolution.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/pdf-remove-unused-resources.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/protect-pdf-document.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/reorder-pages.md create mode 100644 python-net/developer-guide/rendering-documents/rendering-to-pdf/set-image-size-limits-when-rendering-to-pdf.md create mode 100644 python-net/rendering-basics/render-xml-documents.md diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/adjust-jpeg-images-quality.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/adjust-jpeg-images-quality.md new file mode 100644 index 0000000..1fd5774 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/adjust-jpeg-images-quality.md @@ -0,0 +1,40 @@ +--- +id: adjust-jpeg-images-quality +url: viewer/python-net/adjust-jpeg-images-quality +title: Specify the JPEG image quality +weight: 3 +description: "Adjust JPEG images quality when rendering documents to PDF with GroupDocs.Viewer for Python via .NET" +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- +Decreasing the JPG images quality reduces the size of the output file. + +To adjust images quality, set the [image_quality](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property of the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/) class. The value must be between 1 (minimum quality) and 100. The default value is 90. + +To set the image quality, follow these steps: + +1. Instantiate the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class. Specify the source document path as a constructor parameter. +1. Instantiate the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object. +2. Set the [PdfViewOptions.pdf_optimization_options](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/#properties) value as instantiated [PdfOptimizationOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/) object. +3. Set the [PdfViewOptions.pdf_optimization_options.image_quality](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) value. +4. Call the [view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) object. Specify the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object as the parameter. + +The following code snippet shows how to adjust JPG image quality in the output PDF document: + +{{< tabs "example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + # Create view options. + viewOptions = gvo.PdfViewOptions() + + # Specify the JPG image quality. + pdf_optimization_options = gvo.PdfOptimizationOptions() + pdf_optimization_options.image_quality = 50 + # Specify pdf_optimization_options object + viewOptions.pdf_optimization_options = pdf_optimization_options + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md new file mode 100644 index 0000000..6bfe135 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/_index.md @@ -0,0 +1,21 @@ +--- +id: optimization-pdf-options +url: viewer/python-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 Python API for web browser or to reduce size." +keywords: convert to pdf, optimize size, optimize browser, optimize web, pdf reduce size +productName: GroupDocs.Viewer for Python via .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/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md new file mode 100644 index 0000000..69cc932 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-for-web.md @@ -0,0 +1,28 @@ +--- +id: optimization-pdf-for-web +url: viewer/python-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 Python API for web browser or to reduce size." +keywords: convert to pdf, optimize browser, optimize web +productName: GroupDocs.Viewer for Python via .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 "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.lineriaze = True + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md new file mode 100644 index 0000000..6af16cd --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-resources.md @@ -0,0 +1,28 @@ +--- +id: optimization-pdf-resources +url: viewer/python-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 Python API to reduce size." +keywords: convert to pdf, optimize size, pdf reduce size +productName: GroupDocs.Viewer for Python via .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 "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md new file mode 100644 index 0000000..92dfd02 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimization-pdf-spreadsheets.md @@ -0,0 +1,32 @@ +--- +id: optimization-pdf-spreadsheets +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize browser, optimize web +productName: GroupDocs.Viewer for Python via .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 "Python" >}} +```python +with gv.Viewer("invoice.xlsx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.optimize_spreadsheets = True + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md new file mode 100644 index 0000000..7f1eedb --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/_index.md @@ -0,0 +1,11 @@ +--- +id: optimize-content +url: viewer/python-net/optimize-content +title: Optimize content +weight: 5 +description: "Optimize content of a PDF file using GroupDocs.Viewer for Python via .NET " +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +isMenuItemWithNoContent: True +--- + diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md new file mode 100644 index 0000000..cf4198e --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-annotations.md @@ -0,0 +1,35 @@ +--- +id: optimization-pdf-remove-annotations +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize size, pdf reduce size, remove annotations +productName: GroupDocs.Viewer for Python via .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 [remove_annotations](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property to `True`. + +The following code snippet shows how to remove annotations from the file: + +{{< tabs "Example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.remove_annotations = True + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Remove annotations](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-remove-annotations.png) diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md new file mode 100644 index 0000000..d620daf --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-content/optimization-pdf-remove-fields.md @@ -0,0 +1,35 @@ +--- +id: optimization-pdf-remove-fields +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize size, pdf reduce size, remove fields +productName: GroupDocs.Viewer for Python via .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 [remove_form_fields](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property to `True`. + +The following code snippet shows how to flatten form fields in the file: + +{{< tabs "Example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.remove_form_fields = True + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Remove fields](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-remove-fields.png) \ No newline at end of file diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md new file mode 100644 index 0000000..5496130 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/_index.md @@ -0,0 +1,11 @@ +--- +id: optimize-fonts +url: viewer/python-net/optimize-fonts +title: Optimize fonts +weight: 6 +description: "Optimize fonts in a PDF file using GroupDocs.Viewer for Python via .NET" +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +isMenuItemWithNoContent: True +--- + diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md new file mode 100644 index 0000000..ac5315e --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-fonts/optimization-pdf-subset-fonts.md @@ -0,0 +1,39 @@ +--- +id: optimization-pdf-subset-fonts +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize size, pdf reduce size, subset fonts +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +toc: True +--- +Not optimized files may contain embedded fonts. GroupDocs.Viewer can remove unused instructions in embedded fonts to reduce the file size. + +To subset fonts in a PDF file, set the [subset_fonts](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property to `True`. + +The following code snippet shows how to subset fonts in a PDF file: + +{{< tabs "Example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.subset_fonts = True + + viewer.view(viewOptions) +``` +{{< /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) diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md new file mode 100644 index 0000000..7fddf7b --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/_index.md @@ -0,0 +1,11 @@ +--- +id: optimize-images +url: viewer/python-net/optimize-images +title: Optimize images +weight: 4 +description: "Optimize images in a PDF file using GroupDocs.Viewer for Python via .NET" +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +isMenuItemWithNoContent: True +--- + diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md new file mode 100644 index 0000000..31187c1 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-convert-grayscale.md @@ -0,0 +1,35 @@ +--- +id: optimization-pdf-convert-grayscale +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize size, pdf reduce size, convert to grayscale +productName: GroupDocs.Viewer for Python via .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 [convert_to_gray_scale](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property to `True`. + +The following code snippet shows how to convert a PDF file to grayscale: + +{{< tabs "Example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.convert_to_gray_scale = True + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Convert to grayscale](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-convert-grayscale.png) diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-reduce-image-quality.md b/python-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..0209f3f --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-reduce-image-quality.md @@ -0,0 +1,39 @@ +--- +id: optimization-pdf-reduce-image-quality +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize size, pdf reduce size, compress images +productName: GroupDocs.Viewer for Python via .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 [compress_images](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property to `True`. The GroupDocs.Viewer compresses all images in the file. + +The [image_quality](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) 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 "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.compress_images = True + viewOptions.pdf_optimization_options.image_quality = 50 + + viewer.view(viewOptions) +``` +{{< /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) diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-set-max-resolution.md b/python-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..07f0b3f --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/optimize-images/optimization-pdf-set-max-resolution.md @@ -0,0 +1,38 @@ +--- +id: optimization-pdf-set-max-resolution +url: viewer/python-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 Python API." +keywords: convert to pdf, optimize size, pdf reduce size, set resolution +productName: GroupDocs.Viewer for Python via .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 [compress_images](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) and [resize_images](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) properties to `True`. The GroupDocs.Viewer compresses all images in the file. The [max_resolution](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/#properties) property determines the maximum resolution. + +The following code snippet shows how to reduce image resolution in the file: + +{{< tabs "Example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.docx") as viewer: + + viewOptions = gvo.PdfViewOptions() + viewOptions.pdf_optimization_options = gvo.PdfOptimizationOptions() + viewOptions.pdf_optimization_options.compress_images = True + viewOptions.pdf_optimization_options.image_quality = 50 + viewOptions.pdf_optimization_options.resize_images = True + viewOptions.pdf_optimization_options.max_resolution = 100 + + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +The following image demonstrates the result: + +![Set max resolution](/viewer/net/images/developer-guide/pdf-rendering/optimization/optimization-pdf-set-max-resolution.png) diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/pdf-remove-unused-resources.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/pdf-remove-unused-resources.md new file mode 100644 index 0000000..5b48495 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/optimization-pdf-options/pdf-remove-unused-resources.md @@ -0,0 +1,50 @@ +--- +id: optimization-pdf-resources +url: viewer/python-net/optimization-pdf-remove-unused-resources +title: Optimize the PDF file by removing unused resources +linkTitle: Optimize the PDF file by removing unused resources +weight: 10 +description: "This topic describes how to optimize PDF file using the GroupDocs.Viewer Python API by removing the unused (orphaned) resources and thus to reduce the file size." +keywords: convert to pdf, optimize size, pdf reduce size, pdf remove unused resources, pdf remove orphaned resources +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +toc: True +--- + +In some cases [PDF](https://docs.fileformat.com/pdf/) documents may contain different resources, which are unused, which means they are not accessible and visible when viewing the document in any PDF viewer. Starting from this [version 24.9](https://releases.groupdocs.com/viewer/python-net/release-notes/2024/groupdocs-viewer-for-python-via-net-24-9-release-notes/) the GroupDocs.Viewer is able to remove such unused resources using wo new public properties of the boolean type: `remove_unused_objects` and `remove_unused_streams`, both of which are located in the [`PdfOptimizationOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfoptimizationoptions/) class. By default both options are disabled (`False`), so the GroupDocs.Viewer will not apply this optimization. + +In order to explain these two options and their differences, we need to dive into the PDF structure a little bit. + +PDF document consists of PDF objects. Every object has its number (ID) and may belong to one of the following types: name, string, number, boolean, null object, dictionary, array (forms PDF document structure), and stream (raw binary data). Objects may be referenced from other objects, for example, a dictionary or array may contain references to other objects. These references unite all parts of the PDF document and form a PDF document structure. Stream objects contain binary data, and the size of these data may be large. For example, images or fonts are stored as stream objects. After some manipulations with the document, some streams may be "orphaned" i.e. they may not have any reference to them. For example, the old image was replaced with the new one, but the binary data of the old image was not removed. In other words, the stream does not belong anymore to the document logically but still contained in the document physically. For removing such orphaned objects the `remove_unused_objects` property exists — it finds orphaned objects in the document and removes them, this can help to decrease the document size of such objects found. + +Every document page has its `Resources` dictionary which contains data like images, fonts, etc. which are used in the page contents. Resources are referenced by their names in the dictionary, for example, the page may contain the operator to draw the image with the name "Image12" on the particular place of the page. In some cases, the resource may become unused, for example, the image was removed from the page contents but left in page resources, or the page was extracted from the document but its resources still contain common resources of the document. Resource became "orphaned", please note that this is another situation, then described in `RemoveUnusedObject` explanation, because the object is still referenced from the resources dictionary of the page, but the resource is never used by the page (its name never used in page contents). `remove_unused_streams` property, when enabled, finds and removes these unnecessary resources. Since after this process removed resource stream objects became not linked with document structure, `remove_unused_objects` option is automatically activated when `RemoveUnusedResources` is used. + +Here is an example, where both options are applied to the same input PDF file, so Viewer produces two output PDF files with distinct options applied. + +{{< tabs "Example1">}} +{{< tab "Python" >}} +```python +view_options_1 = gvo.PdfViewOptions() +view_options_1.pdf_optimization_options = gvo.PdfOptimizationOptions() +view_options_1.pdf_optimization_options.remove_unused_objects = True + +view_options_2 = gvo.PdfViewOptions() +view_options_2.pdf_optimization_options = gvo.PdfOptimizationOptions() +view_options_2.pdf_optimization_options.remove_unused_streams = True + +with gv.Viewer("sample.pdf") as viewer: + viewer.view(view_options_1) + viewer.view(view_options_2) +``` +{{< /tab >}} +{{< /tabs >}} + +As it is explained above, the effectiveness of the described optimizations depends solely on the specific PDF file — if it has no “orphaned” objects or streams, then these optimizations will do nothing, they only increase the document processing time. However, in some cases they can reduce the document size significantly, even several times. + +We checked both `remove_unused_objects` and `remove_unused_streams` on our internal sample PDF documents, and measured their size before and after applied optimizations. Results are shown in the table below. + +| Filename | Original size, bytes | `remove_unused_objects`, bytes | `remove_unused_streams`, bytes | +| ----------- | ------- | -------- | ------- | +| [Sample1.pdf](/viewer/net/sample-files/developer-guide/rendering-documents/Sample1.pdf) | 131 832 | 2 274 | 131 832 | +| [Sample2.pdf](/viewer/net/sample-files/developer-guide/rendering-documents/Sample2.pdf) | 131 870 | 131 774 | 2 690 | + diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/protect-pdf-document.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/protect-pdf-document.md new file mode 100644 index 0000000..e2ed518 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/protect-pdf-document.md @@ -0,0 +1,47 @@ +--- +id: pdf-viewer-protect-pdf-documents +url: viewer/python-net/protect-pdf-documents +title: Protect PDF document +weight: 2 +description: "Protect PDF documents when rendering documents using GroupDocs.Viewer for Python via .NET" +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- +You can protect a PDF document by setting the following parameters: + +* permissions +* password to open document +* password to change permissions + +To protect a PDF document, follow these steps: + +1. Create an instance of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) class. Specify the source document path as a constructor parameter. +2. Instantiate the [Security](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/security) object. +3. To specify a password to open the document, set the [DocumentOpenPassword](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/security/#properties) property. +4. To specify a password to change restrictions, set the [PermissionsPassword](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/security/#properties) property. +5. To specify the document permissions, set the [Permissions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/permissions) property. +6. Instantiate the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object. Specify the saving path format for the rendered document. +7. Initialize the [Security](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/#properties) property of the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object with the object created in steps 2-5. +8. Call the [view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) object. Specify the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object as the parameter. + +The following code snippet shows how to protect the output PDF document: + +{{< tabs "example1">}} +{{< tab "Python">}} +```python +with gv.Viewer("sample.docx") as viewer: + # Specify the security settings. + security = gvo.Security() + security.document_open_password = "o123" + security.permissions_password = "p123" + security.permissions = gvo.Permissions.ALLOW_ALL & ~gvo.Permissions.DENY_PRINTING + + # Create a PDF file. + pdf_options = gvo.PdfViewOptions() + + # Apply the security settings + pdf_options.security = security + viewer.view(pdf_options) +``` +{{< /tab >}} +{{< /tabs >}} \ No newline at end of file diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/reorder-pages.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/reorder-pages.md new file mode 100644 index 0000000..3cdc178 --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/reorder-pages.md @@ -0,0 +1,31 @@ +--- +id: reorder-pages +url: viewer/python-net/reorder-pages +title: Reorder pages +weight: 1 +description: "Reorder pages when rendering documents to PDF with GroupDocs.Viewer for Python via .NET" +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- +GroupDocs.Viewer preserves the page order in the source document. Instead, you may reorder pages in the output PDF document. + +To reorder pages, follow these steps: + +1. Instantiate the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) object. +2. Create the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object. +3. Call the [view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method of the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) object. Specify the new page order in the last parameters. + +The following code snippet shows how to reorder pages: + +{{< tabs "example1">}} +{{< tab "Python">}} +```python +with gv.Viewer("sample.docx") as viewer: + # Create view options. + viewOptions = gvo.PdfViewOptions() + + # Pass page numbers in the order you want to render them. + viewer.view(viewOptions, 2, 1) +``` +{{< /tab >}} +{{< /tabs >}} diff --git a/python-net/developer-guide/rendering-documents/rendering-to-pdf/set-image-size-limits-when-rendering-to-pdf.md b/python-net/developer-guide/rendering-documents/rendering-to-pdf/set-image-size-limits-when-rendering-to-pdf.md new file mode 100644 index 0000000..a92b81e --- /dev/null +++ b/python-net/developer-guide/rendering-documents/rendering-to-pdf/set-image-size-limits-when-rendering-to-pdf.md @@ -0,0 +1,78 @@ +--- +id: set-image-size-limits-when-rendering-to-pdf +url: viewer/python-net/set-image-size-limits-when-rendering-to-pdf +title: Set image size limits +weight: 4 +description: "Set image size limits when rendering image to PDF" +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +--- +The [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) class has the following properties to set the image width or/and height: + +{{< tabs "example2">}} +{{< tab "Python">}} +```python +""" + + Max width of an output image in pixels. + +""" +image_max_width # int + +""" + + Max height of an output image in pixels. + +""" +image_max_height # int + +""" + + The width of the output image in pixels. + +""" +image_width # int + +""" + + The height of an output image in pixels. + +""" +image_height # int + +``` +{{< /tab >}} +{{< /tabs >}} + +You can set the width and/or height of the output images. Use one of the following methods: + +* To render a single image, set image_width/image_height options. +* To render multiple images, set image_max_width/image_max_height options. If an image exceeds these limits, it is resized proportionally. + +{{< alert style="warning" >}} +If you set the image_width/image_height options, the image_max_width/image_max_height options are ignored. +{{< /alert >}} + +To set the image_max_width/image_max_height options, follow these steps: + +1. Instantiate the [Viewer](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer) object. +2. Instantiate the [PdfViewOptions](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions) object. +3. Set the image_max_width and/or image_max_height values; +4. Call the [view](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. + +The following code snippet shows how to set the output image size limits: + +{{< tabs "example1">}} +{{< tab "Python" >}} +```python +with gv.Viewer("sample.jpg") as viewer: + # Create a PDF file. + viewOptions = gvo.PdfViewOptions() + + # Specify the maximum width and height. + viewOptions.image_max_width = 800 + viewOptions.image_max_height = 600 + viewer.view(viewOptions) +``` +{{< /tab >}} +{{< /tabs >}} \ No newline at end of file diff --git a/python-net/getting-started/supported-document-formats.md b/python-net/getting-started/supported-document-formats.md index 84e674e..6b57822 100644 --- a/python-net/getting-started/supported-document-formats.md +++ b/python-net/getting-started/supported-document-formats.md @@ -17,6 +17,7 @@ This topic lists file formats supported by GroupDocs.Viewer for Python. You can | Format | Description | Automatic format detection | | --- | --- | :---: | +| [7Z](https://docs.fileformat.com/compression/7z/) | 7-Zip Compressed File | ![(tick)](/viewer/net/images/check-blue.png) | | [BZ2](https://docs.fileformat.com/compression/bz2) | Bzip2 Compressed File | ![(tick)](/viewer/python-net/images/check-blue.png) | | [GZ](https://docs.fileformat.com/compression/gz) | Gnu Zipped Archive | ![(tick)](/viewer/python-net/images/check-blue.png) | | [RAR](https://docs.fileformat.com/compression/rar) | WinRAR Compressed Archive | ![(tick)](/viewer/python-net/images/check-blue.png) | @@ -25,6 +26,8 @@ This topic lists file formats supported by GroupDocs.Viewer for Python. You can | [TXZ](https://docs.fileformat.com/compression/xz/) | XZ Compressed Tar Archive | ![(tick)](/viewer/python-net/images/check-blue.png) | | [XZ](https://docs.fileformat.com/compression/xz/) | XZ Compressed Archive | ![(tick)](/viewer/python-net/images/check-blue.png) | | [ZIP](https://docs.fileformat.com/compression/zip) | Zipped File | ![(tick)](/viewer/python-net/images/check-blue.png) | +| [Zstandard](https://docs.fileformat.com/compression/zst) | Zstandard Archive | ![(tick)](/viewer/net/images/check-blue.png) | +| [ISO](https://docs.fileformat.com/compression/iso) | Optical Disk Image | ![(tick)](/viewer/net/images/check-blue.png) | Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view archive files: [Render archives as HTML, PDF, and image files](/viewer/python-net/render-archive-files). @@ -61,6 +64,8 @@ Refer to the following help topic for details on how to use GroupDocs.Viewer to | --- | --- | :---: | --- | | [EPUB](https://docs.fileformat.com/ebook/epub/) | Open EBook Format | ![(tick)](/viewer/python-net/images/check-blue.png) | | [MOBI](https://docs.fileformat.com/ebook/mobi/) | Mobipocket EBook | ![(tick)](/viewer/python-net/images/check-blue.png) | +| [AZW3](https://docs.fileformat.com/ebook/azw3/) | AZ3/KF8 EBook Format| ![(tick)](/viewer/net/images/check-blue.png) | + ## Email file formats @@ -99,9 +104,11 @@ Refer to the following help topic for details on how to use GroupDocs.Viewer to | [JP2](https://docs.fileformat.com/image/jp2/) | JPEG 2000 Core Image File | ![(tick)](/viewer/python-net/images/check-blue.png) | | | [JPC](https://docs.fileformat.com/image/jpc/) | JPEG 2000 Code Stream File | ![(tick)](/viewer/python-net/images/check-blue.png) | | | [JPEG / JPG](https://docs.fileformat.com/image/jpeg) | JPEG Image | ![(tick)](/viewer/python-net/images/check-blue.png) | | +| [JFIF](https://docs.fileformat.com/image/jfif) | JPEG File Interchange Format | ![(tick)](/viewer/net/images/check-blue.png) | | | [JPF](https://docs.fileformat.com/image/jpf/) | JPEG 2000 Image | ![(tick)](/viewer/python-net/images/check-blue.png) | | | [JPM](https://docs.fileformat.com/image/jpm/) | JPEG 2000 Multi-layer Image Format | ![(tick)](/viewer/python-net/images/check-blue.png) | | | [JPX](https://docs.fileformat.com/image/jpx/) | JPEG 2000 Image File | ![(tick)](/viewer/python-net/images/check-blue.png) | | +| [JLS](https://docs.fileformat.com/) | JPEG-LS Image | ![(tick)](/viewer/net/images/check-blue.png) | | | [ODG](https://docs.fileformat.com/image/odg/) | OpenDocument Graphics File | ![(tick)](/viewer/python-net/images/check-blue.png) | | | [OTG](https://docs.fileformat.com/image/otg/) | OpenDocument Graphics Template | ![(tick)](/viewer/python-net/images/check-blue.png) | | | [PCL](https://docs.fileformat.com/page-description-language/pcl/) | Printer Command Language Document | ![(tick)](/viewer/python-net/images/check-blue.png) | | @@ -294,5 +301,3 @@ Refer to the following help topic for details on how to use GroupDocs.Viewer to | [RTF](https://docs.fileformat.com/word-processing/rtf/) | Rich Text Document | ![(tick)](/viewer/python-net/images/check-blue.png) | | Refer to the following help topic for details on how to use GroupDocs.Viewer to load and view Word documents: [Render Word documents as HTML, PDF, and image files](/viewer/python-net/render-word-documents/). - - diff --git a/python-net/rendering-basics/render-xml-documents.md b/python-net/rendering-basics/render-xml-documents.md new file mode 100644 index 0000000..027bd04 --- /dev/null +++ b/python-net/rendering-basics/render-xml-documents.md @@ -0,0 +1,205 @@ +--- +id: render-xml-documents +url: viewer/python-net/render-xml-documents +title: Render XML documents as HTML, PDF, PNG, and JPEG files +linkTitle: Render XML documents +weight: 10 +description: "This topic describes how to use the GroupDocs.Viewer Python API to convert XML documents to HTML (with and without pagination), PDF documents, PNG, and JPEG raster formats." +keywords: convert xml to html, xml to html, xml to pdf, xml to jpeg, xml to png, xml to image, xml correcter, fix xml structure +productName: GroupDocs.Viewer for Python via .NET +hideChildren: False +toc: True +aliases: + - /viewer/python-net/view-xml-documents + - /viewer/python-net/how-to-convert-and-view-xml-files +--- +[GroupDocs.Viewer for Python via .NET](https://products.groupdocs.com/viewer/python-net) started to support XML format a long time ago, but XML documents were treated as plain text, and thus it was not as useful as it might be. Starting from [version 24.9](https://releases.groupdocs.com/viewer/python-net/release-notes/2024/groupdocs-viewer-for-python-via-net-24-9-release-notes/#new-xml-converter), the completely new XML processing module was implemented, and now XML documents are processed differently, not as plain text documents. This article explains this new XML processing module. + +## Opening the XML document + +First of all need to emphasize that the new XML processing module had not touched the public API at all — no new options, classes, properties or methods were added or modified. In order to process input XML document properly using the new XML processing module, need to either specify the [`LoadOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/loadoptions/) class instance with [`FileType.XML`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/filetype/) in its [constructor](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/loadoptions/#constructors) or just pass the XML document as filename with `*.xml` extension. Code example below shows all possible ways: + +{{< tabs "Loading example">}} +{{< tab "Python" >}} +```python +# 1. Specify by filename +with gv.Viewer("Sample.xml") as viewer: + # do some work... + +# 2. Specify by load options +load_options = gvo.LoadOptions() +load_options.file_type = gv.FileType.XML + +with gv.Viewer("Sample.xml", load_options) as viewer: + # do some work... +``` +{{< /tab >}} +{{< /tabs >}} + + +If the instance of the [`Viewer`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class is initialized using one of the ways described above, the new XML processing module will be used. + +By default all XML documents must have an [XML declaration](https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction#xml_declaration), which is located in the very beginning of the XML document and which stores the encoding of the consecutive content, for example: + +`` + +By default GroupDocs.Viewer uses it. But there is a possibility to override this character encoding, if needed. In order to do this the [`LoadOptions.encoding`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/loadoptions/#properties) property should be set while initializing the [`Viewer`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class, as it is shown below: + +{{< tabs "Custom encoding example">}} +{{< tab "Python" >}} +```python +load_options = gvo.LoadOptions(gv.FileType.XML) +load_options.encoding = "ASCII" + +with gv.Viewer("Sample.xml", load_options) as viewer: + # do some work... +``` +{{< /tab >}} +{{< /tabs >}} + + +The rest of this article explains features of this new XML processing module. + +## Representation + +The main task of the new XML processing module is to represent the XML markup, obtained from the user, in a structured, formatted, hierarchical view, with highlighting of every distinct entity of this XML structure. For the GroupDocs.Viewer there is no matter how human-friendly is represented the XML markup in original document: it may be divided by line breaks onto separate lines per every element, or the whole document may be stored in a single line of text; it may have indents or not, — all of this does not matter. The GroupDocs.Viewer parses the input XML document and creates a hierarchical Document Object Model (DOM), and then serializes it to the HTML, PDF, PNG or JPEG depending on user options. + +In particular, when serializing, GroupDocs.Viewer puts every XML element (node) on a new line, and with left indent, which indicates nesting of a certain element. Every entity of the XML document, — XML element, attribute, its value, text node, XML comment, CDATA section, — has its own highlighting: font style, type, color, size and so on. All quotes, used for enquoting the attribute values, are unified. + +The screenshot below shows such scenario. On the left side there is a [sample XML document](/viewer/net/sample-files/render-xml-documents/books-single-line.xml), where all content is stored within a single line, with no indents, line breaks, horizontal tabs, or even extra whitespaces. On the right side the resultant HTML file, generated by the GroupDocs.Viewer, is shown. There can be seen structured view with corrent line breaks and indents, valid highlighting of every XML entity, and recognition of the URIs and email addresses. + +![Generate HTML view for input XML](/viewer/net/images/rendering-basics/render-xml-documents/XML-to-HTML.png) + +## Fix incorrect XML structure + +The World Wide Web Consortium has clearly defined what is a valid XML document, and what is not. The term “[well-formed document](https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction#correct_xml_valid_and_well-formed)” defines a those XML document, which "adheres to the syntax rules specified by the XML 1.0 specification in that it must satisfy both physical and logical structures"([ref](http://www.csdservices.com/articles/csdservices)). In particular, a valid XML document must contain only valid characters, its start tags and end tags must be matched, correctly opened and closed, elements must be properly nested, and so on. Unfortunately, not all existing XML documents are well-formed and sometimes there is a necessity to view them. Different XML markup viewers often are unable to properly show invalid XML documents. + +GroupDocs.Viewer with its new XML processing module is able to correctly parse, process, format, highlight and view even the heavily distorted XML documents. There is partial list of different damages in XML structure, which GroupDocs.Viewer can fix and process: + +- Invalid and illegal characters, including `<` and `&` characters in wrong places. +- Start tags, which are not closed. +- End tags, which are not opened. +- Interleaved (overlapped) tags. +- Start and end tags with unmatched letter cases. +- Truncated (cutted from end) markup. +- Attribute names without values. +- Un-enquoted attribute values (without enclosing quotes). +- Attribute values, which are enquoted partially, with only opening or only closing quote. +- Attribute values, which have redundant quote inside. + +GroupDocs.Viewer detects and fixes all these and even more issues in XML markup and also writes them to the log. + +Screenshot below demonstrates this in action. [Sample XML file "InvalidXml.xml"](/viewer/net/sample-files/render-xml-documents/InvalidXml.xml) contains all possible damages, described above. In cannot be correctly formatted and highlighted by most popular XML viewing and editing applications. But with the new XML processing module the GroupDocs.Viewer fixes its structure and displays it absolutely correct. + +![Generate HTML view for input XML](/viewer/net/images/rendering-basics/render-xml-documents/XML-fixed.png) + +## Recognition of URIs and email addresses + +While processing the XML markup, the GroupDocs.Viewer scans the XML content for any valid URI, if found, represents them as external links in the resultant HTML format: by using the [A element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a). GroupDocs.Viewer is searching for URIs in: text nodes, CDATA sections, XML comments, attribute values, DocType definitions. + +Regarding the email addresses, the GroupDocs.Viewer searches them only in attribute values, and if found, represents them with [mailto](https://en.wikipedia.org/wiki/Mailto) scheme and [A element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a). + +If the XML document is saved not to the HTML format, but to the PDF, the URIs and email addresses will be interactive too. But if the output format is PNG or JPEG, the output will be a raster image without any interactive links, of course. + +## Saving to HTML format + +For saving the documents to the HTML format the GroupDocs.Viewer provides a [`HtmlViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) class. There are two ways of creating an instance of this class: using either [`for_external_resources`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) or [`for_embedded_resources`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#methods) static methods. First method is designed for saving HTML document in a such way, that all its resources (stylesheets, images, fonts etc) are stored separately, while second method stores all resources of the HTML document inside its content: stylesheets are saved inside the STYLE elements, SVG graphics is inlined inside HTML markup, while all other resources (mostly raster images and fonts) are stored according to the [data URI scheme](https://en.wikipedia.org/wiki/Data_URI_scheme) and converted to the [base64](https://en.wikipedia.org/wiki/Base64) format. + +But in the context of the XML documents the way of creating the [`HtmlViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) instance is not important, because the XML documents cannot have resources, which may be stored externally or embedded. So, when saving XML documents to the HTML, you can create the [`HtmlViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) instance in both ways — the result will be the same, no external resources will be produced. + +Another important thing is that the XML format by its nature has no pages — it is a hierarchical structure, where some elements are nested inside another, and there is no even similar to pages here. So the best way to represent them in HTML format is to generate a single-page HTML document, so all XML content will be represented in a single HTML document. In order to do this the option [`HtmlViewOptions.render_to_single_page`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#properties) needs to be set up to the true value. By default this option has a false value, so the output HTML document will be paginated — splitted into multiple chunks. + +Code example below shows rendering of input XML file to the HTML in both ways: + +{{< tabs "Saving to HTML example">}} +{{< tab "Python" >}} +```python +paginated_html_options = gvo.HtmlViewOptions.for_embedded_resources("page-{0}.html") +single_html_options = gvo.HtmlViewOptions.for_embedded_resources("single-page.html") +single_html_options.render_to_single_page = True + +with gv.Viewer("Sample.xml") as viewer: + viewer.view(paginated_html_options) + viewer.view(single_html_options) +``` +{{< /tab >}} +{{< /tabs >}} + +All other options, which are present in the [`HtmlViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/) class, have no effect when saving XML to HTML, except the [`render_to_single_page`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/htmlviewoptions/#properties) flag. + +## Saving to PDF format + +PDF format by its nature has pages, so if the XML content because of its big size cannot fit in the single PDF page, then it will be paginated. Unlike the HTML, PNG, or JPEG, the GroupDocs.Viewer generates only a single PDF file for a single input XML document, with one or more pages. [`PdfViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) class is responsible for saving XML to the PDF, and example below shows this: + +{{< tabs "Saving to PDF example">}} +{{< tab "Python" >}} +```python +pdf_options = gvo.PdfViewOptions("output.pdf") +with gv.Viewer("Sample.xml") as viewer: + viewer.view(pdf_options) +``` +{{< /tab >}} +{{< /tabs >}} + +As for the version 24.8 all options, which are present in the [`PdfViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pdfviewoptions/) class, have no effect when saving XML to PDF. + +## Saving to raster PNG and JPEG formats + +[`PngViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) and [`JpgViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) are responsible for saving XML to the PNG and JPEG raster image formats. Like for the PDF, if XML content cannot fit into the area of one image, it will be paginated and spread across multiple images. + +Size of the output images will be calculated automatically based on the XML content, as for the version 24.8 there is no possibility to set the size forcibly, and `width`, `height`, `max_width`, and `max_height` properties of the [`PngViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/pngviewoptions/) and [`JpgViewOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/) classes have no effect when saving XML to PNG or JPEG. + +There is a possibility to set a quality of output JPEG image by setting a [`JpgViewOptions.quality`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/jpgviewoptions/#properties) instance property, which has a default value `90`. + +Example below shows saving input XML to the output PNG and JPEG: + +{{< tabs "Saving to PNG and JPEG example">}} +{{< tab "Python" >}} +```python +pngOptions = gvo.PngViewOptions("page-{0}.png") +jpegOptions = gvo.JpgViewOptions("page-{0}.jpeg") +jpegOptions.quality = 80 + +with gv.Viewer("Sample.xml") as viewer: + viewer.view(pngOptions) + viewer.view(jpegOptions) +``` +{{< /tab >}} +{{< /tabs >}} + +## Retrieving information about XML view + +Like for all other supported formats, GroupDocs.Viewer supports returning information about specific XML documents. Like for all other formats, for doing this you need to call the [`get_view_info`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) instance method of the [`Viewer`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/) class, which returns an instance of [`ViewInfo`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/viewinfo/) class. This [`ViewInfo`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/viewinfo/) instance contains all information about the view depending on [`ViewInfoOptions`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.options/viewinfooptions/), passed to the [`get_view_info`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer/viewer/#methods) method. + +Example below shows obtaining [`ViewInfo`](https://reference.groupdocs.com/viewer/python-net/groupdocs.viewer.results/viewinfo/) for a single XML document for HTML, PDF, and PNG formats. + +{{< tabs "Retrieving information about XML view example">}} +{{< tab "Python" >}} +```python + +view_info_options_html_single = gvo.ViewInfoOptions.for_html_view(True) +view_info_options_pdf = gvo.ViewInfoOptions.for_pdf_view() +view_info_options_png = gvo.ViewInfoOptions.for_png_view() + +with gv.Viewer("Sample.xml") as viewer: + result_html_single = viewer.get_view_info(view_info_options_html_single) + result_pdf = viewer.get_view_info(view_info_options_pdf) + result_png = viewer.get_view_info(view_info_options_png) +``` +{{< /tab >}} +{{< /tabs >}} + +## Conclusion + +Starting from the [version 24.9](https://releases.groupdocs.com/viewer/python-net/release-notes/2024/groupdocs-viewer-for-python-via-net-24-9-release-notes/), the new dedicated XML processing module makes XML support to be a truly powerful and useful feature, and ability to fix and display even the heavily corrupted XML documents allows to use the GroupDocs.Viewer for viewing XML documents in those cases, when all other competitors failed. + + + + + + + + + + +