Skip to content

Commit 047fb17

Browse files
Basic usage
1 parent b9ce663 commit 047fb17

13 files changed

Lines changed: 544 additions & 335 deletions

net/developer-guide/basic-usage/redaction-basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ keywords: text redaction, c#, PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX
88
productName: GroupDocs.Redaction for .NET
99
hideChildren: False
1010
---
11-
GroupDocs.Redaction supports an effective set of document redaction features. It allows to apply redactions for [text](Text%2Bredactions.html), [metadata](Metadata%2Bredactions.html), [annotations](Annotation%2Bredactions.html), [images]({{< ref "redaction/net/developer-guide/basic-usage/image-redactions.md" >}}).
11+
GroupDocs.Redaction supports an effective set of document redaction features. It allows to apply redactions for [text]({{< ref "redaction/net/developer-guide/basic-usage/text-redactions.md" >}}), [metadata]({{< ref "redaction/net/developer-guide/basic-usage/metadata-redactions.md" >}}), [annotations]({{< ref "redaction/net/developer-guide/basic-usage/annotation-redactions.md" >}}), [images]({{< ref "redaction/net/developer-guide/basic-usage/image-redactions.md" >}}).
1212

1313
Wide range of document formats is supported, such as: PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and others. See full list of supported formats at [supported document formats]({{< ref "redaction/net/getting-started/supported-document-formats.md" >}}) article
1414

python-net/developer-guide/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ title: Developer Guide
55
weight: 3
66
description: ""
77
keywords:
8-
productName: GroupDocs.Redaction for .NET
8+
productName: GroupDocs.Redaction for Python via .NET
99
hideChildren: False
1010
---
1111
{{< alert style="info" >}}
12-
This section describes some basic and advanced use cases of GroupDocs.Redaction for .NET. Please refer to [GitHub repository](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-.NET) for more examples and samples.
12+
This section describes some basic and advanced use cases of GroupDocs.Redaction for Python via .NET. Please refer to [GitHub repository](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Python-via-.NET.git) for more examples and samples.
1313
{{< /alert >}}

python-net/developer-guide/basic-usage/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Basic usage
55
weight: 1
66
description: ""
77
keywords:
8-
productName: GroupDocs.Redaction for .NET
8+
productName: GroupDocs.Redaction for Python via .NET
99
hideChildren: False
1010
---
1111
## Quick Start section for GroupDocs.Redaction API

python-net/developer-guide/basic-usage/annotation-redactions.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Annotation redactions
55
weight: 7
66
description: This article shows the implementation of annotation redaction for documents of different formats like PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and others.
77
keywords: annotation, redactions,PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX
8-
productName: GroupDocs.Redaction for .NET
8+
productName: GroupDocs.Redaction for Python via .NET
99
hideChildren: False
1010
---
1111
With GroupDocs.Redaction API you can apply annotation redactions for documents of different formats like PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and others. See full list at [supported document formats]({{< ref "redaction/python-net/getting-started/supported-document-formats.md" >}}) article.
@@ -16,15 +16,24 @@ GroupDocs.Redactions provides a flexible API that allows to remove sensitive dat
1616

1717
You can use GroupDocs.Redaction to remove all or specific comments and other annotations from the document. For example, we can remove all comments from the document, containing texts like "use", "show" or "describe" in its body:
1818

19-
**C#**
19+
**Python**
2020

21-
```csharp
22-
using (Redactor redactor = new Redactor(@"D:\test.docx"))
23-
{
24-
redactor.Apply(new DeleteAnnotationRedaction("(?im:(use|show|describe))"));
21+
```python
22+
import groupdocs.redaction as gr
23+
import groupdocs.redaction.redactions as grr
2524

26-
redactor.Save()
27-
}
25+
def run():
26+
# Specify the redaction options
27+
a_red = grr.DeleteAnnotationRedaction("(?im:(use|show|describe))")
28+
29+
# Load the document to be redacted
30+
with gr.Redactor("source.pdf") as redactor:
31+
32+
# Apply the redaction
33+
result = redactor.apply(a_red)
34+
35+
# Save the redacted document
36+
redactor.save()
2837
```
2938

3039
You can use constructor without arguments to remove all annotations within the document.
@@ -33,15 +42,24 @@ You can use constructor without arguments to remove all annotations within the d
3342

3443
Instead of removing all or specific annotations, you can remove sensitive data from the annotation text. For instance, we can remove all mentions of "John" in the given document, e.g.:
3544

36-
**C#**
45+
**Python**
46+
47+
```python
48+
import groupdocs.redaction as gr
49+
import groupdocs.redaction.redactions as grr
3750

38-
```csharp
39-
using (Redactor redactor = new Redactor(@"C:\test.pdf"))
40-
{
41-
redactor.Apply(new AnnotationRedaction("(?im:john)", "[redacted]"));
51+
def run():
52+
# Specify the redaction options
53+
a_red = grr.AnnotationRedaction("(?im:john)", "[redacted]")
4254

43-
redactor.Save()
44-
}
55+
# Load the document to be redacted
56+
with gr.Redactor("source.pdf") as redactor:
57+
58+
# Apply the redaction
59+
result = redactor.apply(a_red)
60+
61+
# Save the redacted document
62+
redactor.save()
4563
```
4664

4765
## More resources
@@ -54,8 +72,8 @@ To learn more about document redaction features, please refer to the [advanced u
5472

5573
You may easily run the code above and see the feature in action in our GitHub examples:
5674

75+
* [GroupDocs.Redaction for Python via .NET examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Python-via-.NET)
5776
* [GroupDocs.Redaction for .NET examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-.NET)
58-
5977
* [GroupDocs.Redaction for Java examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Java)
6078

6179

python-net/developer-guide/basic-usage/get-document-page-preview.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

python-net/developer-guide/basic-usage/get-file-info.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Get file info
55
weight: 2
66
description: This article explains the ability of the GroupDocs.Redaction API to get the general document information, which includes FileType, PageCount and FileSize.
77
keywords: redaction, c#, FileType, PageCount, FileSize
8-
productName: GroupDocs.Redaction for .NET
8+
productName: GroupDocs.Redaction for Python via .NET
99
hideChildren: False
1010
---
1111
GroupDocs.Redaction provides general document information, which includes:
@@ -18,22 +18,31 @@ The following code examples demonstrate how to get document information.
1818

1919
## Get file info for a file from local disk
2020

21-
```csharp
22-
using (Redactor redactor = new Redactor("source.docx"))
23-
{
24-
IDocumentInfo info = redactor.GetDocumentInfo();
25-
Console.WriteLine("\nFile type: {0}\nNumber of pages: {1}\nDocument size: {2} bytes", info.FileType, info.PageCount, info.Size);
26-
}
21+
```python
22+
import groupdocs.redaction as gr
23+
24+
def run():
25+
with gr.Redactor("source.docx") as redactor:
26+
info = redactor.get_document_info()
27+
28+
print(f"File type: {info.file_type}")
29+
print(f"Number of pages: {info.page_count}")
30+
print(f"Document size: {info.size} bytes")
2731
```
2832

2933
## Get file info for a file from Stream
3034

31-
```csharp
32-
using (Redactor redactor = new Redactor(File.OpenRead("source.docx"))
33-
{
34-
IDocumentInfo info = redactor.GetDocumentInfo();
35-
Console.WriteLine("\nFile type: {0}\nNumber of pages: {1}\nDocument size: {2} bytes", info.FileType, info.PageCount, info.Size);
36-
}
35+
```python
36+
import groupdocs.redaction as gr
37+
38+
def run():
39+
with open("source.docx", "rb") as stream:
40+
with gr.Redactor(stream) as redactor:
41+
info = redactor.get_document_info()
42+
43+
print(f"File type: {info.file_type}")
44+
print(f"Number of pages: {info.page_count}")
45+
print(f"Document size: {info.size} bytes")
3746
```
3847

3948
## More resources
@@ -46,8 +55,8 @@ To learn more about document redaction features, please refer to the [advanced u
4655

4756
You may easily run the code above and see the feature in action in our GitHub examples:
4857

58+
* [GroupDocs.Redaction for Python via .NET examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Python-via-.NET)
4959
* [GroupDocs.Redaction for .NET examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-.NET)
50-
5160
* [GroupDocs.Redaction for Java examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Java)
5261

5362

python-net/developer-guide/basic-usage/get-supported-file-formats.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,25 @@ title: Get supported file formats
55
weight: 1
66
description: This article shows that how to get the list of all supported file formats of GroupDocs.Redaction by using C#.
77
keywords: C#, redaction
8-
productName: GroupDocs.Redaction for .NET
8+
productName: GroupDocs.Redaction for Python via .NET
99
hideChildren: False
1010
---
1111
GroupDocs.Redaction allows to get the list of all supported file formats by these steps:
1212

13-
* Call [GetSupportedFileTypes](https://reference.groupdocs.com/python-net/redaction/groupdocs.redaction/filetype/methods/getsupportedfiletypes)of [FileType](https://reference.groupdocs.com/python-net/redaction/groupdocs.redaction/filetype) class;
14-
* Enumerate through the collection of [FileType](https://reference.groupdocs.com/python-net/redaction/groupdocs.redaction/filetype)objects*.*
13+
* Call [GetSupportedFileTypes](https://reference.groupdocs.com/python-net/redaction/groupdocs.redaction/filetype/methods/getsupportedfiletypes) of [FileType](https://reference.groupdocs.com/python-net/redaction/groupdocs.redaction/filetype) class;
14+
* Enumerate through the collection of [FileType](https://reference.groupdocs.com/python-net/redaction/groupdocs.redaction/filetype) objects*.*
1515

1616
The following example demonstrates how to get supported file formats list.
1717

18-
```csharp
19-
IEnumerable<FileType> supportedFileTypes = FileType
20-
.GetSupportedFileTypes()
21-
.OrderBy(f => f.Extension);
18+
```python
19+
import groupdocs.redaction as gr
2220

23-
foreach (FileType fileType in supportedFileTypes)
24-
Console.WriteLine(fileType);
21+
def run():
22+
23+
supported_file_types = gr.FileType.get_supported_file_types()
24+
25+
for file_type in sorted(supported_file_types, key=lambda x: x.extension):
26+
print(file_type);
2527
```
2628

2729
## More resources
@@ -34,8 +36,8 @@ To learn more about document redaction features, please refer to the [advanced u
3436

3537
You may easily run the code above and see the feature in action in our GitHub examples:
3638

39+
* [GroupDocs.Redaction for Python via .NET examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Python-via-.NET)
3740
* [GroupDocs.Redaction for .NET examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-.NET)
38-
3941
* [GroupDocs.Redaction for Java examples](https://github.com/groupdocs-redaction/GroupDocs.Redaction-for-Java)
4042

4143

0 commit comments

Comments
 (0)