You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-contents-of-rar-or-zip-document-to-different-formats-and-compress.md
GroupDocs.Conversion provides flexible options for working with archive files like ZIP, RAR, 7z, and TAR. This guide covers three common workflows for processing archive contents using the FluentConverter API.
13
+
GroupDocs.Conversion provides three workflows for processing archive files (ZIP, RAR, 7z, TAR).
14
14
15
-
## Prerequisites
15
+
## Three Archive Workflows
16
16
17
-
The workflows in this guide require the **FluentConverter API** (introduced in v22.1, reworked in v23.6). All examples use the v24.10+ syntax with `SaveContext`.
18
-
19
-
## Three Ways to Work with Archives
20
-
21
-
GroupDocs.Conversion supports three distinct workflows for archive files:
22
-
23
-
| Workflow | What It Does | When to Use | Result |
24
-
|----------|-------------|-------------|--------|
25
-
|**[Workflow 1](#workflow-1-extract-and-convert-to-individual-files)**| Extract and convert each file separately | You need individual converted files, not an archive | Separate files (e.g., doc-1.pdf, doc-2.pdf) |
26
-
|**[Workflow 2](#workflow-2-repackage-archive-format)**| Change archive format without modifying contents | Change compression format for compatibility or size | New archive format (e.g., ZIP → 7z) |
27
-
|**[Workflow 3](#workflow-3-convert-contents-and-re-compress)**| Convert contents AND create new archive | Need converted files packaged in an archive | New archive with converted contents |
17
+
| Workflow | What It Does | Result |
18
+
|----------|-------------|--------|
19
+
|**[Workflow 1](#workflow-1-extract-and-convert-to-individual-files)**| Extract and convert each file separately | Individual converted files |
20
+
|**[Workflow 2](#workflow-2-repackage-archive-format)**| Change archive format without modifying contents | New archive format (ZIP → 7z) |
21
+
|**[Workflow 3](#workflow-3-convert-contents-and-re-compress)**| Convert contents AND create new archive | New archive with converted contents |
28
22
29
23
## Workflow 1: Extract and Convert to Individual Files
30
24
31
-
**Use Case:** You have a ZIP file containing multiple Word documents and need each one as a separate PDF file.
32
-
33
-
This is the most common workflow. Files are extracted from the archive, converted to your target format, and saved as individual files—no re-compression.
34
-
35
-
### Example: ZIP with DOCX Files → Separate PDFs
25
+
Extract files from an archive and convert each one separately (no re-compression).
36
26
37
27
```csharp
38
28
usingGroupDocs.Conversion.Fluent;
39
29
usingGroupDocs.Conversion.Options.Convert;
30
+
usingGroupDocs.Conversion.Contracts;
40
31
usingSystem.IO;
41
32
42
33
// ZIP contains: report.docx, summary.docx, analysis.docx
// Output: archive.7z containing the same files as the original ZIP
162
-
```
163
-
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
-
171
-
### Why Repackage Archives?
172
-
173
-
-**Better compression:** Convert ZIP to 7z for smaller file sizes
174
-
-**Cross-platform compatibility:** Convert proprietary formats to open standards (e.g., RAR to ZIP)
175
-
-**Standardization:** Consolidate different archive formats to one standard format
176
-
-**Add security:** Repackage with password protection (see [CompressionConvertOptions]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}) for details)
177
-
178
-
### Supported Output Formats
179
-
180
-
You can repackage archives to these formats:
181
-
182
-
-**ZIP** - Most widely supported, good compression
183
-
-**7z (SevenZ)** - Best compression ratio, open source
184
-
-**TAR** - Standard on Unix/Linux systems
185
-
-**Others:** TAR.GZ, TAR.BZ2, and more
186
-
187
-
**Note:** RAR output is not supported due to licensing restrictions. RAR archives can be read as input but not created as output.
84
+
For more examples and advanced options, see [Convert Archive Formats]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}).
188
85
189
86
## Workflow 3: Convert Contents and Re-compress
190
87
191
-
**Use Case:** You have a RAR file containing Word documents and need them converted to PDFs, packaged in a new ZIP archive.
192
-
193
-
This workflow combines content conversion with re-compression. Files are extracted, converted to a target format, and packaged into a new archive.
194
-
195
-
### Example: RAR with DOCX → ZIP with PDFs
88
+
Extract files, convert them, and package into a new archive:
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" >}}).
246
-
247
137
## Choosing the Right Workflow
248
138
249
-
Use this decision guide to select the appropriate workflow:
250
-
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
**Important:** RAR archives can only be read, not created (licensing restrictions).
149
+
**Output (write):** ZIP, 7z, TAR, TAR.GZ, TAR.BZ2, TAR.XZ (RAR output not supported due to licensing)
289
150
290
151
## Version Compatibility
291
152
292
-
All examples in this guide use **v24.10+ syntax** with `SaveContext`:
153
+
All examples use **v24.10+ syntax** with `SaveContext`:
293
154
294
155
```csharp
295
156
.ConvertTo((SaveContextsaveContext) =>...)
296
157
```
297
158
298
-
If you're using a version **before v24.10**, use the older syntax without `SaveContext`:
159
+
For versions **before v24.10**, use:
299
160
300
161
```csharp
301
162
.ConvertTo(() =>...)
302
163
```
303
164
304
-
The rest of the code remains the same.
305
-
306
165
## See Also
307
166
308
-
-[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" >}}) - Complete API reference for CompressionConvertOptions
309
-
-[Common Conversion Options]({{< ref "conversion/net/developer-guide/advanced-usage/converting/common-conversion-options/_index.md" >}}) - Watermarks, page selection, and more
310
-
-[FluentConverter API Reference](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.fluent/fluentconverter/) - Complete API documentation
0 commit comments