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-to-html-with-advanced-options.md
+31-4Lines changed: 31 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,13 @@ keywords: Convert to HTML, Convert HTML
8
8
productName: GroupDocs.Conversion for .NET
9
9
hideChildren: False
10
10
---
11
-
GroupDocs.Conversion provides[WebConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions) to give you control over conversion result. The following options could be set:
11
+
GroupDocs.Conversion provides[WebConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions) to give you control over conversion result. The following options could be set:
12
12
13
-
*[FixedLayout](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/fixedlayout) controls the HTML generation. If it's set to *true*, fixed layout will be used e.g. absolutely positioned HTML element.
14
-
*[Zoom](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/zoom) specifies the zoom level in percentage. The default value is 100.
15
-
*[UsePdf](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/usepdf). Sometimes, for better rendering and elements positioning the source document should be converted to PDF first. If this property is set to *true*, the input firstly is converted to PDF and after that to desired format.
13
+
*[FixedLayout](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/fixedlayout) controls the HTML generation. If it's set to *true*, fixed layout will be used e.g. absolutely positioned HTML element.
14
+
*[FixedLayoutShowBorders](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/fixedlayoutshowborders) controls the display of page borders during fixed layout conversion. Default is true.
15
+
*[EmbedFontResources](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/embedfontresources) specifies whether to embed font resources within the main HTML. Default is false. Note: fonts automatically embed when FixedLayout is enabled.
16
+
*[Zoom](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/zoom) specifies the zoom level in percentage. The default value is 100.
17
+
*[UsePdf](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webconvertoptions/usepdf). Sometimes, for better rendering and elements positioning the source document should be converted to PDF first. If this property is set to *true*, the input firstly is converted to PDF and after that to desired format.
16
18
17
19
The following code snippet shows how to convert to HTML with advanced options
18
20
@@ -29,6 +31,25 @@ using (Converter converter = new Converter("sample.docx"))
29
31
}
30
32
```
31
33
34
+
## Embedding Font Resources
35
+
36
+
Control whether font resources are embedded within the HTML file:
37
+
38
+
```csharp
39
+
using (Converterconverter=newConverter("sample.docx"))
40
+
{
41
+
WebConvertOptionsoptions=newWebConvertOptions
42
+
{
43
+
EmbedFontResources=true// Embed fonts directly in HTML
When `EmbedFontResources` is set to false (default), font files are stored separately and referenced by the HTML file. When set to true, all font data is embedded directly within the HTML file, making it self-contained but larger in size.
50
+
51
+
Note: When `FixedLayout` is enabled, fonts are automatically embedded regardless of the `EmbedFontResources` setting.
52
+
32
53
### Control page borders visibility
33
54
34
55
The following code snippet shows how to convert to HTML and control page borders visibility
@@ -44,3 +65,9 @@ using (var converter = new Converter(source))
Copy file name to clipboardExpand all lines: net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-to-image-with-advanced-options.md
description: "Follow this guide and learn how to convert documents to image with height, width, resolution, brightness and other customizationsusing GroupDocs.Conversion for .NET."
6
+
description: "Follow this guide and learn how to convert documents to image with height, width, resolution, brightness and other customizationsusing GroupDocs.Conversion for .NET."
7
7
keywords: Convert to Image, Convert Image
8
8
productName: GroupDocs.Conversion for .NET
9
9
hideChildren: False
10
10
---
11
-
GroupDocs.Conversion provides [ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions) to give you control over conversion result when convert to image. Along with[common convert options]({{< ref "conversion/net/developer-guide/advanced-usage/converting/common-conversion-options/_index.md" >}}) from the base class,[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions) has the following additional options:
11
+
GroupDocs.Conversion provides [ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions) to give you control over conversion result when convert to image. Along with[common convert options]({{< ref "conversion/net/developer-guide/advanced-usage/converting/common-conversion-options/_index.md" >}}) from the base class,[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions) has the following additional options:
*[Width](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/width) specifies desired image width after conversion.
15
15
*[Height](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/height) specifies desired image height after conversion.
16
16
*[HorizontalResolution](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/horizontalresolution) specifies desired image horizontal resolution after conversion.
17
17
*[VerticalResolution](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/verticalresolution) specifies desired image vertical resolution after conversion.
18
18
*[Grayscale](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/grayscale) specifies if true converted image will be grayscaled.
*[BackgroundColor](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/backgroundcolor) sets the background color where supported by the source format.
25
+
*[CropArea](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/croparea) crops a rectangular area from the raster image after conversion. Specify as Rectangle(x, y, width, height).
24
26
*[JpegOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/jpegoptions) contains JPEG specific convert options.
25
27
*[TiffOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/tiffoptions) contains TIFF specific convert options.
26
28
*[PsdOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/psdoptions) contains PSD specific convert options.
27
-
*[WebpOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/webpoptions)contains WebP specific convert options.
28
-
*[UsePdf](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/usepdf). Sometimes, for better rendering and elements positioning the source document should be converted to PDF first. If this property is set to*true*, the input firstly is converted to PDF and after that to desired format.
29
+
*[WebpOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/webpoptions)contains WebP specific convert options.
30
+
*[UsePdf](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions/usepdf). Sometimes, for better rendering and elements positioning the source document should be converted to PDF first. If this property is set to*true*, the input firstly is converted to PDF and after that to desired format.
29
31
30
32
The following code snippet shows how to convert to image with advanced options:
31
33
@@ -75,41 +77,113 @@ using (Converter converter = new Converter("sample.pdf"))
75
77
}
76
78
```
77
79
80
+
## Setting Background Color
81
+
82
+
Set a background color for the converted image where supported by the source format:
83
+
84
+
```csharp
85
+
usingSystem.Drawing;
86
+
using (Converterconverter=newConverter("sample.pdf"))
87
+
{
88
+
ImageConvertOptionsoptions=newImageConvertOptions
89
+
{
90
+
Format=ImageFileType.Png,
91
+
BackgroundColor=Color.White// Use System.Drawing.Color
Crop a specific rectangular area from the converted image. The CropArea property takes a Rectangle with X, Y coordinates for the top-left corner, and Width, Height for the dimensions:
115
+
116
+
```csharp
117
+
usingGroupDocs.Conversion.Contracts;
118
+
using (Converterconverter=newConverter("sample.pdf"))
119
+
{
120
+
ImageConvertOptionsoptions=newImageConvertOptions
121
+
{
122
+
Format=ImageFileType.Png,
123
+
CropArea=newRectangle(100, 100, 400, 300) // X, Y, Width, Height
124
+
};
125
+
converter.Convert("cropped-image.png", options);
126
+
}
127
+
```
128
+
129
+
You can combine BackgroundColor and CropArea:
130
+
131
+
```csharp
132
+
usingSystem.Drawing;
133
+
usingGroupDocs.Conversion.Contracts;
134
+
using (Converterconverter=newConverter("sample.pdf"))
[JpegOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/jpegoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to JPEG format.
148
+
[JpegOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/jpegoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to JPEG format.
*[ColorMode](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/jpegoptions/colormode)sets JPEG color mode. Available options are:*Rgb, YCbCr, Cmyk, Ycck, Grayscale*.
154
+
*[Compression](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/jpegoptions/compression)setsJPEG compression methods. Available options are:*Baseline, Progressive, Lossless, JpegLs*.
87
155
88
156
### TiffOptions
89
157
90
-
[TiffOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/tiffoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to TIFF format.
158
+
[TiffOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/tiffoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to TIFF format.
[PsdOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/psdoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to PSD format.
166
+
[PsdOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/psdoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to PSD format.
99
167
100
168
The following options are available:
101
169
102
-
*[ChannelBitsCount](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/psdoptions/channelbitscount)sets bits count per channel.
103
-
*[ChannelsCount](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/psdoptions/channelscount)sets color channels count.
*[ChannelBitsCount](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/psdoptions/channelbitscount)sets bits count per channel.
171
+
*[ChannelsCount](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/psdoptions/channelscount)sets color channels count.
[WebpOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webpoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to WebP format.
178
+
[WebpOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webpoptions)is subset of[ImageConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/imageconvertoptions)which allow enhanced control over conversions to WebP format.
111
179
112
180
The following options are available:
113
181
114
182
*[Lossless](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webpoptions/lossless) sets the compression of the converted image will be lossless.
115
-
*[Quality](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webpoptions/quality) sets set the quality of converted image.
183
+
*[Quality](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/webpoptions/quality) sets set the quality of converted image.
0 commit comments