Skip to content

Commit 544b9e0

Browse files
committed
update working with compression documents articles
1 parent f7ac202 commit 544b9e0

2 files changed

Lines changed: 447 additions & 250 deletions

File tree

net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-contents-of-rar-or-zip-document-to-different-formats-and-compress.md

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,59 @@ FluentConverter.Load("documents.zip")
8787

8888
This workflow changes the archive format while preserving the original file contents. No document conversion occurs.
8989

90-
### Example: ZIP → 7z (No Content Conversion)
90+
GroupDocs.Conversion provides **three methods** to accomplish this. Use whichever fits your needs:
91+
92+
### Method 1: Standard Converter API (Recommended - Simplest!)
93+
94+
The most straightforward approach for basic format conversion:
95+
96+
```csharp
97+
using GroupDocs.Conversion;
98+
using GroupDocs.Conversion.Options.Convert;
99+
using GroupDocs.Conversion.FileTypes;
100+
101+
using (var converter = new Converter("archive.zip"))
102+
{
103+
var options = new CompressionConvertOptions
104+
{
105+
Format = CompressionFileType.SevenZ
106+
};
107+
converter.Convert("archive.7z", options);
108+
}
109+
110+
// Output: archive.7z containing the same files as the original ZIP
111+
```
112+
113+
### Method 2: FluentConverter with WithOptions (Clean Alternative)
114+
115+
If you prefer FluentConverter syntax:
116+
117+
```csharp
118+
using GroupDocs.Conversion.Fluent;
119+
using GroupDocs.Conversion.Options.Convert;
120+
using GroupDocs.Conversion.Contracts;
121+
using GroupDocs.Conversion.FileTypes;
122+
using System.IO;
123+
124+
FluentConverter.Load("archive.zip")
125+
.ConvertTo((SaveContext saveContext) => File.Create("archive.7z"))
126+
.WithOptions(new CompressionConvertOptions
127+
{
128+
Format = CompressionFileType.SevenZ
129+
})
130+
.Convert();
131+
132+
// Output: archive.7z containing the same files as the original ZIP
133+
```
134+
135+
### Method 3: FluentConverter with Compress (Advanced Scenarios)
136+
137+
For advanced stream-based workflows:
91138

92139
```csharp
93140
using GroupDocs.Conversion.Fluent;
94141
using GroupDocs.Conversion.Options.Convert;
142+
using GroupDocs.Conversion.Contracts;
95143
using GroupDocs.Conversion.FileTypes;
96144
using System.IO;
97145

@@ -113,6 +161,13 @@ FluentConverter.Load("archive.zip")
113161
// Output: archive.7z containing the same files as the original ZIP
114162
```
115163

164+
**Which method to choose?**
165+
- **Method 1** (Standard API): Simplest, recommended for most users
166+
- **Method 2** (WithOptions): Clean alternative if using FluentConverter
167+
- **Method 3** (Compress): Advanced scenarios with stream handling
168+
169+
See [Convert Archive Formats]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}) for detailed comparison and more examples.
170+
116171
### Why Repackage Archives?
117172

118173
- **Better compression:** Convert ZIP to 7z for smaller file sizes
@@ -187,23 +242,28 @@ FluentConverter.Load("sensitive-files.zip")
187242
.Convert();
188243
```
189244

190-
For more advanced options including different compression formats, optimization settings, and best practices, see [Convert to Compression with advanced options]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}).
245+
For more advanced options including different compression formats, optimization settings, and best practices, see [Convert Archive Formats (ZIP, 7z, TAR, RAR)]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}).
191246

192247
## Choosing the Right Workflow
193248

194249
Use this decision guide to select the appropriate workflow:
195250

196-
| Your Goal | Workflow | Key API Methods |
197-
|-----------|----------|-----------------|
198-
| Extract and convert each file separately | **Workflow 1** | `Load()``ConvertTo()``WithOptions()``Convert()` |
199-
| Change archive format only (no conversion) | **Workflow 2** | `Load()``ConvertTo()``Compress()``Convert()` |
200-
| Convert contents AND create new archive | **Workflow 3** | `Load()``ConvertTo()``WithOptions()``Compress()``Convert()` |
251+
| Your Goal | Workflow | Recommended Method |
252+
|-----------|----------|-------------------|
253+
| Extract and convert each file separately | **Workflow 1** | FluentConverter: `Load()``ConvertTo()``WithOptions()``Convert()` |
254+
| Change archive format only (no conversion) | **Workflow 2** | Standard API: `new Converter().Convert()` with `CompressionConvertOptions` |
255+
| Convert contents AND create new archive | **Workflow 3** | FluentConverter: `Load()``ConvertTo()``WithOptions()``Compress()``Convert()` |
256+
257+
**Workflow 2 Options (all work):**
258+
- **Method 1:** Standard Converter API - `new Converter().Convert()` (simplest)
259+
- **Method 2:** FluentConverter with `.WithOptions()` - clean alternative
260+
- **Method 3:** FluentConverter with `.Compress()` - advanced scenarios
201261

202262
**Quick Tips:**
203263

204-
- **No `.Compress()`** = Individual files (Workflow 1)
205-
- **No `.WithOptions()`** = Archive format change only (Workflow 2)
206-
- **Both `.WithOptions()` and `.Compress()`** = Convert and re-compress (Workflow 3)
264+
- **Workflow 1:** FluentConverter required (multiple output files)
265+
- **Workflow 2:** Standard API recommended (simplest for format change)
266+
- **Workflow 3:** FluentConverter required (content conversion + compression)
207267

208268
## Supported Archive Formats
209269

0 commit comments

Comments
 (0)