Skip to content

Commit

Permalink
Add Loading Documents examples and update the shields label
Browse files Browse the repository at this point in the history
  • Loading branch information
RakhimAimaganbetov committed Apr 30, 2024
1 parent 75d673a commit 490d33a
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python-net/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ AddLibInfoScript: True

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAABuCAYAAADGWyb7AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAwvSURBVHgB7Z1PbBzVHcd/v7dWqqREbKBqGxTkDaiReood1zHi0DhSb42EObWXKo5UDvSSpFK5QVK4gYSTUw9UwqiH0lMSCbjG7qEiDskaqVJForaOEpGWNrAo/0Rg34/f782OM56dWb/592bWno8UZnfsnTXvO78/7/fem4cwhFD72THQX49pwBYAjiJAk8+O9X7Kr7EZ+kSHz3UAwRyJYIXPXVMKlgFGVnD8b8swZCBUHGpPN0HfnQGl9hLRNBC1+oXJAcQFRBGSFgG2LeD4QgcqTCWFo/YzLQB9mAhFqGkoAxaSqHtOqZGzOP7hClSMyggnlqX1nVnExnOliRUHW6ImOt1QjYWqiFi6cGxd06DpMIGeKcQF5gwBziuFvy9bwNKEE8E4Zp2onHXZYmKiEXABSsC5cEMvWBhPwCOuLdCZcF52eH+OgGZhA+LahToRjtpTR0nrk8MQwzKywgKebkxcOAUFU6hwktazW3x7w7hFe1ZQqYNFWp+CgvCsrNvehKIJLfYw7e6lqWNQELlbnIllcPcEaSzsjx4mUNEpHL94HHImV+E816jPcKQeg5ogubvO3ISjpckxauAZftmCmihyFS8X4TzR4PwmyBqz0sHuyEHcn300InNywu7xMFtauxbNiiY1vmlLm0FGMlmcEU3reahJDLvNWXab70BKUgvXi2ltqEkNu83xtG4zlas02aOJaTVZYLd5npaeTZWBJxbOiKZ1nYjkg8S8M97AcTKSC2d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XD1qMywgUxViib7Zp9W0typSJWlxbViJovMq1PSyWFC0Lt6SZ0701rxGkWcm9BQnbkKYJc5VhUoJdBffdsVSwrjsoLF4WMRoDCljY7ceEoC9ris012sVKl8f8F6cDD6YXLHKc65tGB8uTALiznVfh1ybfJD5kBiJZdnAAAAABJRU5ErkJggg==" alt="groupdocs-viewer-python-home" align="left" style="width:110px; margin: 0 30px 30px 0"/>

<img src="https://img.shields.io/nuget/v/groupdocs.viewer?label=GroupDocs.Viewer%20for%20.NET%20NuGet" alt="Nuget package">
<img src="https://img.shields.io/nuget/dt/GroupDocs.Viewer?label=nuget%20downloads" alt="Nuget downloads">
<img src="https://img.shields.io/pypi/v/groupdocs.viewer?label=GroupDocs.Viewer%20for%20Python%20PyPI
" alt="PyPI package">
<img src="https://img.shields.io/pypi/dm/GroupDocs.Viewer?label=pypi%20downloads" alt="PyPI downloads">

{{< button style="primary" link="https://releases.groupdocs.com/viewer/python-net/release-notes/" >}} <svg class="gdoc-icon gdoc-product-doc__btn-icon"><use xlink:href="/img/groupdocs-stack.svg#document"></use></svg> Release notes {{< /button >}}
{{< button style="primary" link="https://pypi.org/project/groupdocs.viewer" >}} {{< icon "gdoc_download" >}} Package repository {{< /button >}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: load-document-from-local-disk
url: viewer/python-net/load-document-from-local-disk
title: Load document using the local path string
weight: 1
description: "This article explains how to load a document using the local path string with GroupDocs.Viewer within your Python applications."
productName: GroupDocs.Viewer for Python via .NET
hideChildren: False
---
You can load a document from a local disk using a path to a file. GroupDocs.Viewer opens the file in the read-only mode.

The following code snippet shows how to load a document using the local path string:

{{< tabs "example1">}}
{{< tab "Python" >}}
```python
with gv.Viewer("sample.docx") as viewer:
html_options = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html")
viewer.view(html_options)
```
{{< /tab >}}
{{< /tabs >}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: load-document-from-stream
url: viewer/python-net/load-document-from-stream
title: Load from stream
weight: 2
description: "This article explains how to load a document from a Stream with GroupDocs.Viewer within your Python applications."
productName: GroupDocs.Viewer for Python via .NET
hideChildren: False
---
You can load a document from a stream without saving it as a file on a disk. You can use this feature to load a document from different sources like a URL, FTP, and so on.

To load a document from a stream, follow these steps:

1. Implement a method to get the document stream.
2. Call the [Viewer](https://reference.groupdocs.com/python-net/viewer/groupdocs.viewer/viewer) class constructor. Specify the method implemented in the previous step.

The following code snippet shows how to load a document from a stream:

{{< tabs "example1">}}
{{< tab "Python" >}}
```python
stream = open("sample.docx", "rb")

# Render a document from the stream.
with gv.Viewer(stream) as viewer:
options = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html")
viewer.view(options)
```
{{< /tab >}}
{{< /tabs >}}

Please refer to the following pages for examples:
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: load-document-from-url
url: viewer/python-net/load-document-from-url
title: Load from URL
weight: 3
description: "This article explains how to load a document from a URL with GroupDocs.Viewer within your Python applications."
productName: GroupDocs.Viewer for Python via .NET
hideChildren: False
---
The following code snippet shows how to load a document from a URL:

{{< tabs "example1">}}
{{< tab "Python" >}}
```python
import requests
import io

def download_file(url):
response = requests.get(url, stream=True, headers={"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"}, timeout=10)
# Check if the request was successful (status code 200)
response.raise_for_status()
# Create a BytesIO stream from the content
stream = io.BytesIO(response.content)
return stream


url = "https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/blob/master/Examples/GroupDocs.Viewer.Examples.CSharp/Resources/SampleFiles/sample.docx?raw=true";

stream = download_file(url)

with gv.Viewer(stream) as viewer:
options = gvo.HtmlViewOptions.for_embedded_resources("page_{0}.html")
viewer.view(options)


```
{{< /tab >}}
{{< /tabs >}}

0 comments on commit 490d33a

Please sign in to comment.