Skip to content

Commit 4d1f4a1

Browse files
committed
Merge branch 'staging'
2 parents 731aa18 + 0f851c2 commit 4d1f4a1

28 files changed

Lines changed: 5541 additions & 110 deletions
Lines changed: 114 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,147 @@
11
---
22
id: convert-contents-of-rar-or-zip-to-different-formats-and-compress
33
url: conversion/net/convert-contents-of-rar-or-zip-document-to-different-formats-and-compress
4-
title: Convert contents of RAR or ZIP to different formats and compress
4+
title: Extract and Convert Archive Contents
55
weight: 12
6-
description: "Learn how to convert contents of RAR/ZIP archives to a different format based on content type using GroupDocs.Conversion for .NET."
7-
keywords: Convert RAR, Convert ZIP
6+
description: "Learn how to extract files from archives (ZIP, RAR, 7z, TAR) and convert them to different formats using GroupDocs.Conversion for .NET."
7+
keywords: Extract ZIP, Convert ZIP contents, Extract RAR, Convert archive files, Extract and convert, Archive extraction
88
productName: GroupDocs.Conversion for .NET
99
hideChildren: False
10+
toc: True
1011
---
1112

12-
GroupDocs.Conversion provides a flexible API to control the conversion of archives that contain other documents.
13+
GroupDocs.Conversion can extract files from archives (ZIP, RAR, 7z, TAR) and convert each file to a different format. This guide covers two workflows for processing archive contents.
1314

14-
The following code snippet shows how to convert each constituent
15-
file of a RAR archive into a PDF format and then compress them to a single ZIP archive:
15+
**To convert archive formats** (ZIP to 7z, etc.) **without extracting contents**, see [Convert Archive Formats]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}).
1616

17-
With v24.10 and later:
17+
## Two Content Extraction Workflows
18+
19+
| Workflow | What It Does | Result |
20+
|----------|-------------|--------|
21+
| **[Workflow 1](#workflow-1-extract-and-convert-to-individual-files)** | Extract and convert each file separately | Individual converted files (e.g., doc-1.pdf, doc-2.pdf) |
22+
| **[Workflow 2](#workflow-2-convert-contents-and-re-compress)** | Convert contents AND create new archive | New archive with converted contents |
23+
24+
## Workflow 1: Extract and Convert to Individual Files
25+
26+
Extract files from an archive and convert each one separately (no re-compression).
1827

1928
```csharp
20-
FluentConverter.Load("sample.rar")
21-
.ConvertTo((SaveContext saveContext) => new MemoryStream()).WithOptions(new PdfConvertOptions())
22-
.Compress(new CompressionConvertOptions { Format = CompressionFileType.Zip }).OnCompressionCompleted(
23-
compressedStream =>
24-
{
25-
using (var fs = new FileStream("converted.zip", FileMode.Create))
26-
{
27-
compressedStream.CopyTo(fs);
28-
}
29-
})
29+
using GroupDocs.Conversion.Fluent;
30+
using GroupDocs.Conversion.Options.Convert;
31+
using GroupDocs.Conversion.Contracts;
32+
using System.IO;
33+
34+
// ZIP contains: report.docx, summary.docx, analysis.docx
35+
FluentConverter.Load("documents.zip")
36+
.ConvertTo((SaveContext saveContext) =>
37+
{
38+
// Create separate output file for each document
39+
string fileName = $"converted-document-{saveContext.ItemIndex}.pdf";
40+
return File.Create(Path.Combine(@"C:\output", fileName));
41+
})
42+
.WithOptions(new PdfConvertOptions())
3043
.Convert();
44+
45+
// Output: converted-document-1.pdf, converted-document-2.pdf, converted-document-3.pdf
3146
```
3247

33-
Before v24.10:
48+
**Using original filenames:**
3449

3550
```csharp
36-
FluentConverter.Load("sample.rar")
37-
.ConvertTo(() => new MemoryStream()).WithOptions(new PdfConvertOptions())
38-
.Compress(new CompressionConvertOptions { Format = CompressionFileType.Zip }).OnCompressionCompleted(
39-
compressedStream =>
40-
{
41-
using (var fs = new FileStream("converted.zip", FileMode.Create))
42-
{
43-
compressedStream.CopyTo(fs);
44-
}
45-
})
51+
FluentConverter.Load("documents.zip")
52+
.ConvertTo((SaveContext saveContext) =>
53+
{
54+
string originalName = saveContext.SourceFileName ?? $"document-{saveContext.ItemIndex}";
55+
string fileName = Path.ChangeExtension(originalName, ".pdf");
56+
return File.Create(Path.Combine(@"C:\output", fileName));
57+
})
58+
.WithOptions(new PdfConvertOptions())
4659
.Convert();
47-
```
4860

61+
// Output: report.pdf, summary.pdf, analysis.pdf
62+
```
4963

50-
The following code snippet shows how to convert each constituent
51-
file of a ZIP archive to a PDF format and then compress them as password-protected ZIP archive:
64+
## Workflow 2: Convert Contents and Re-compress
5265

53-
With v24.10 and later:
66+
Extract files, convert them, and package into a new archive:
5467

5568
```csharp
56-
FluentConverter.Load("sample.zip")
57-
.ConvertTo((SaveContext saveContext) => new MemoryStream()).WithOptions(new PdfConvertOptions())
58-
.Compress(new CompressionConvertOptions
59-
{
60-
Format = CompressionFileType.Zip,
61-
Password = "123"
62-
}).OnCompressionCompleted(
63-
compressedStream =>
69+
using GroupDocs.Conversion.Fluent;
70+
using GroupDocs.Conversion.Options.Convert;
71+
using GroupDocs.Conversion.Contracts;
72+
using GroupDocs.Conversion.FileTypes;
73+
using System.IO;
74+
75+
FluentConverter.Load("documents.rar")
76+
.ConvertTo((SaveContext saveContext) => new MemoryStream())
77+
.WithOptions(new PdfConvertOptions())
78+
.Compress(new CompressionConvertOptions
79+
{
80+
Format = CompressionFileType.Zip
81+
})
82+
.OnCompressionCompleted(compressedStream =>
83+
{
84+
using (var fileStream = File.Create("converted-documents.zip"))
6485
{
65-
using (var fs = new FileStream("converted.zip", FileMode.Create))
66-
{
67-
compressedStream.CopyTo(fs);
68-
}
69-
})
86+
compressedStream.CopyTo(fileStream);
87+
}
88+
})
7089
.Convert();
90+
91+
// Output: converted-documents.zip containing PDFs
7192
```
7293

73-
Before v24.10:
94+
**With password protection:**
7495

7596
```csharp
76-
FluentConverter.Load("sample.zip")
77-
.ConvertTo(() => new MemoryStream()).WithOptions(new PdfConvertOptions())
78-
.Compress(new CompressionConvertOptions
79-
{
97+
FluentConverter.Load("sensitive-files.zip")
98+
.ConvertTo((SaveContext saveContext) => new MemoryStream())
99+
.WithOptions(new PdfConvertOptions())
100+
.Compress(new CompressionConvertOptions
101+
{
80102
Format = CompressionFileType.Zip,
81-
Password = "123"
82-
}).OnCompressionCompleted(
83-
compressedStream =>
103+
Password = "SecurePassword123"
104+
})
105+
.OnCompressionCompleted(compressedStream =>
106+
{
107+
using (var fileStream = File.Create("protected-archive.zip"))
84108
{
85-
using (var fs = new FileStream("converted.zip", FileMode.Create))
86-
{
87-
compressedStream.CopyTo(fs);
88-
}
89-
})
109+
compressedStream.CopyTo(fileStream);
110+
}
111+
})
90112
.Convert();
91113
```
114+
115+
## Choosing the Right Workflow
116+
117+
| Your Goal | Use |
118+
|-----------|-----|
119+
| Extract and convert each file separately | **Workflow 1** |
120+
| Convert contents AND create new archive | **Workflow 2** |
121+
| Change archive format only (no conversion) | See [Convert Archive Formats]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-compression-with-advanced-options.md" >}}) |
122+
123+
## Supported Archive Formats
124+
125+
**Input (read):** ZIP, RAR, 7z, TAR, TAR.GZ, TAR.BZ2, TAR.XZ, CAB, LZ, CPIO, ISO
126+
127+
**Output (write):** ZIP, 7z, TAR, TAR.GZ, TAR.BZ2, TAR.XZ (RAR output not supported due to licensing)
128+
129+
## Version Compatibility
130+
131+
All examples use **v24.10+ syntax** with `SaveContext`:
132+
133+
```csharp
134+
.ConvertTo((SaveContext saveContext) => ...)
135+
```
136+
137+
For versions **before v24.10**, use:
138+
139+
```csharp
140+
.ConvertTo(() => ...)
141+
```
142+
143+
## See Also
144+
145+
- [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" >}}) - Change archive format without extracting contents
146+
- [Common Conversion Options]({{< ref "conversion/net/developer-guide/advanced-usage/converting/common-conversion-options/_index.md" >}})
147+
- [FluentConverter API Reference](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.fluent/fluentconverter/)
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
id: convert-to-3d-with-advanced-options
3+
url: conversion/net/convert-to-3d-with-advanced-options
4+
title: Convert to 3D formats with advanced options
5+
weight: 21
6+
description: "Learn about ThreeDConvertOptions class for 3D file formats (FBX, OBJ, GLTF, 3DS, U3D) in GroupDocs.Conversion for .NET."
7+
keywords: Convert to FBX, Convert to OBJ, Convert to GLTF, 3D conversion, 3D model conversion
8+
productName: GroupDocs.Conversion for .NET
9+
hideChildren: False
10+
toc: True
11+
---
12+
13+
GroupDocs.Conversion provides the [ThreeDConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/threedconvertoptions) class to specify 3D file format conversion settings. This class implements [IPagedConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/ipagedconvertoptions) for page selection support.
14+
15+
## Supported 3D Formats
16+
17+
The following 3D (Three-Dimensional) file formats are supported:
18+
19+
| Format | Extension | Description |
20+
|--------|-----------|-------------|
21+
| **FBX** | .fbx | Autodesk FilmBox (motion capture, animation) |
22+
| **3DS** | .3ds | 3D Studio (DOS) mesh file format |
23+
| **3MF** | .3mf | 3D Manufacturing Format |
24+
| **AMF** | .amf | Additive Manufacturing File Format |
25+
| **ASE** | .ase | Autodesk ASCII Scene Export |
26+
| **DAE** | .dae | Digital Asset Exchange (COLLADA) |
27+
| **DRC** | .drc | Google Draco compressed 3D |
28+
| **FBX** | .fbx | Autodesk Filmbox |
29+
| **GLTF** | .gltf | GL Transmission Format (JSON) |
30+
| **GLB** | .glb | Binary GL Transmission Format |
31+
| **OBJ** | .obj | Wavefront 3D Object File |
32+
| **PLY** | .ply | Polygon File Format |
33+
| **RVM** | .rvm | AVEVA Plant Design Model |
34+
| **U3D** | .u3d | Universal 3D File Format |
35+
| **USD** | .usd | Universal Scene Description |
36+
| **USDZ** | .usdz | Universal Scene Description (ZIP) |
37+
| **VRML** | .vrml | Virtual Reality Modeling Language |
38+
| **X** | .x | DirectX 3D Graphics (legacy) |
39+
| **JT** | .jt | Jupiter Tessellation (ISO 14306) |
40+
41+
## Properties
42+
43+
**[Format](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/convertoptions-1/format/)** - Specifies the desired 3D file format. Available options include: *Fbx, Obj, Gltf, ThreeDS, U3d, Dae, Drc, Rvm, Amf, Ply*, and others.
44+
45+
**[PageNumber](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/ipagedconvertoptions/pagenumber)** - Specifies the starting page number for conversion (when source has multiple views/scenes).
46+
47+
**[PagesCount](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/ipagedconvertoptions/pagescount)** - Specifies the number of pages to convert.
48+
49+
## Conversion Examples
50+
51+
ThreeDConvertOptions supports conversion between 3D formats. The following examples demonstrate common conversions.
52+
53+
### FBX to OBJ
54+
55+
Convert an Autodesk FBX model to Wavefront OBJ format:
56+
57+
```csharp
58+
using GroupDocs.Conversion;
59+
using GroupDocs.Conversion.Options.Convert;
60+
using GroupDocs.Conversion.FileTypes;
61+
62+
string sourceFile = "character-model.fbx";
63+
string outputFile = "character-model.obj";
64+
65+
using (var converter = new Converter(sourceFile))
66+
{
67+
var options = new ThreeDConvertOptions
68+
{
69+
Format = ThreeDFileType.Obj
70+
};
71+
converter.Convert(outputFile, options);
72+
}
73+
```
74+
75+
### OBJ to FBX
76+
77+
Convert a Wavefront OBJ model to Autodesk FBX format:
78+
79+
```csharp
80+
using GroupDocs.Conversion;
81+
using GroupDocs.Conversion.Options.Convert;
82+
using GroupDocs.Conversion.FileTypes;
83+
84+
string sourceFile = "building-model.obj";
85+
string outputFile = "building-model.fbx";
86+
87+
using (var converter = new Converter(sourceFile))
88+
{
89+
var options = new ThreeDConvertOptions
90+
{
91+
Format = ThreeDFileType.Fbx
92+
};
93+
converter.Convert(outputFile, options);
94+
}
95+
```
96+
97+
### FBX to GLTF
98+
99+
Convert an FBX model to GLTF (GL Transmission Format) for web and mobile:
100+
101+
```csharp
102+
using GroupDocs.Conversion;
103+
using GroupDocs.Conversion.Options.Convert;
104+
using GroupDocs.Conversion.FileTypes;
105+
106+
string sourceFile = "product-design.fbx";
107+
string outputFile = "product-design.gltf";
108+
109+
using (var converter = new Converter(sourceFile))
110+
{
111+
var options = new ThreeDConvertOptions
112+
{
113+
Format = ThreeDFileType.Gltf
114+
};
115+
converter.Convert(outputFile, options);
116+
}
117+
```
118+
119+
### OBJ to 3DS
120+
121+
Convert an OBJ model to 3D Studio format:
122+
123+
```csharp
124+
using GroupDocs.Conversion;
125+
using GroupDocs.Conversion.Options.Convert;
126+
using GroupDocs.Conversion.FileTypes;
127+
128+
string sourceFile = "terrain-model.obj";
129+
string outputFile = "terrain-model.3ds";
130+
131+
using (var converter = new Converter(sourceFile))
132+
{
133+
var options = new ThreeDConvertOptions
134+
{
135+
Format = ThreeDFileType.ThreeDS
136+
};
137+
converter.Convert(outputFile, options);
138+
}
139+
```
140+
141+
### FBX to U3D
142+
143+
Convert an FBX model to Universal 3D format for PDF embedding:
144+
145+
```csharp
146+
using GroupDocs.Conversion;
147+
using GroupDocs.Conversion.Options.Convert;
148+
using GroupDocs.Conversion.FileTypes;
149+
150+
string sourceFile = "mechanical-part.fbx";
151+
string outputFile = "mechanical-part.u3d";
152+
153+
using (var converter = new Converter(sourceFile))
154+
{
155+
var options = new ThreeDConvertOptions
156+
{
157+
Format = ThreeDFileType.U3d
158+
};
159+
converter.Convert(outputFile, options);
160+
}
161+
```
162+
163+
## Format Support Notes
164+
165+
3D to 3D conversions are supported for most format combinations:
166+
- FBX → OBJ, GLTF, 3DS, U3D, DAE, DRC, AMF, PLY, RVM
167+
- OBJ → FBX, GLTF, 3DS, U3D, DAE, DRC, AMF, PLY, RVM
168+
- GLTF → FBX, OBJ, 3DS, U3D, DAE, DRC, AMF, PLY, RVM
169+
- 3DS → FBX, OBJ, GLTF, U3D, DAE, DRC, AMF, PLY, RVM
170+
- All source 3D formats → Common target formats (FBX, OBJ, GLTF, etc.)
171+
172+
**Note:** To convert FROM 3D formats to PDF, use [PdfConvertOptions]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-pdf-with-advanced-options.md" >}}).
173+
174+
## More Resources
175+
176+
- [API Reference: ThreeDConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/threedconvertoptions)
177+
- [API Reference: ThreeDFileType](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.filetypes/threedfiletype)
178+
- [Convert 3D Formats]({{< ref "conversion/net/developer-guide/basic-usage/convert/3d.md" >}})
179+
- [Supported File Formats]({{< ref "conversion/net/getting-started/supported-document-formats.md" >}})

0 commit comments

Comments
 (0)