Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
With Aspose.HTML for .NET, you can convert EPUB to TIFF format programmatically with full control over a wide range of conversion parameters. In this article, you find information on how to convert EPUB to TIFF using ConvertEPUB() methods of the Converter class, and how to apply ImageSaveOptions and ICreateStreamProvider parameters.
You can check the Aspose.HTML API functionality and convert EPUB in real-time. Please load an EPUB file from the local file system, select the output format and run the example. In the example, the save options are set by default. You will immediately receive the result as a separate file.
If you want to convert EPUB to TIFF programmatically, please see the following C# code examples.
Using Converter.ConvertEPUB() methods is the most common way to convert EPUB files into various formats. To convert EPUB to TIFF, you should follow a few steps:
Please take a look over the following C# code snippet which shows the process of converting EPUB to TIFF using Aspose.HTML for .NET.
1// Convert EPUB to TIFF using C#
2
3// Open an existing EPUB file for reading
4using FileStream stream = File.OpenRead(DataDir + "input.epub");
5
6// Prepare a path to save the converted file
7string savePath = Path.Combine(OutputDir, "input-output.tiff");
8
9// Create an instance of the ImageSaveOptions class
10ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Tiff);
11
12// Call the ConvertEPUB() method to convert EPUB to TIFF
13Converter.ConvertEPUB(stream, options, savePath);Aspose.HTML allows converting EPUB to TIFF using default or custom save options. ImageSaveOptions usage enables you to tune the rendering process. You can specify the page size, margins, CSS, compression, etc.
| Property | Description |
|---|---|
| Compression | Sets Tagged Image File Format (TIFF) Compression. By default, this property is LZW. |
| CSS | Gets a CssOptions object which is used for configuration of CSS properties processing. |
| Format | Sets the ImageFormat (JPG, PNG, BMP, TIFF, or GIF). By default, this property is PNG. |
| BackgroundColor | This property sets the color that will fill the background. By default, this property is Transparent. |
| PageSetup | This property gets a page setup object and uses it for configuration output page-set. |
| HorizontalResolution | Sets horizontal resolution for output images in pixels per inch. The default value is 300 dpi. |
| VerticalResolution | Sets vertical resolution for output images in pixels per inch. The default value is 300 dpi. |
| UseAntialiasing | This property sets the image rendering quality. Antialiasing is enabled by default. |
| Text | Gets a TextOptions object which is used for configuration of text rendering. |
To learn more about the ImageSaveOptions class, please read the Fine-Tuning Converters article.
To convert EPUB to TIFF with ImageSaveOptions specifying, you should follow a few steps:
The following C# code snippet shows how to convert EPUB to TIFF using custom save options:
1// Convert EPUB to TIFF in C# with custom settings
2
3// Open an existing EPUB file for reading
4using FileStream stream = File.OpenRead(DataDir + "input.epub");
5
6// Prepare a path to save the converted file
7string savePath = Path.Combine(OutputDir, "input-options.tiff");
8
9// Create an instance of the ImageSaveOptions class
10ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Tiff)
11{
12 Compression = Compression.None,
13 UseAntialiasing = true,
14 HorizontalResolution = 400,
15 VerticalResolution = 400,
16 BackgroundColor = System.Drawing.Color.AliceBlue
17};
18options.PageSetup.AnyPage = new Page(new Aspose.Html.Drawing.Size(800, 500), new Margin(30, 20, 10, 10));
19
20// Call the ConvertEPUB() method to convert EPUB to TIFF
21Converter.ConvertEPUB(stream, options, savePath);The
ImageSaveOptions() constructor initializes an instance of the ImageSaveOptions class that is passed to ConvertEPUB() method. The ConvertEPUB() method takes the stream, options, output file path savePath and performs the conversion operation.
In the example, we use:
Compression property that sets TIFF compression. Available values are LVZ, CCITT3, CCITT4, Rle, and None. We use None compression schema. By default, this property is
LZW.BackgroundColor property that specifies the color that the background will be filled in. The default BackgroundColor is Transparent.HorizontalResolution and VerticalResolution properties that set horizontal/vertical resolution for output images in pixels per inch. By default, these properties are 300 dpi.UseAntialiasing property that sets the rendering quality for this image.PageSetup property that specifies the
page size and
margins in pixels.You can download the complete examples and data files from GitHub.
Aspose.HTML offers a free online EPUB to TIFF Converter that converts EPUB to TIFF image with high quality, easy and fast. Just upload, convert your files and get results in a few seconds!
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.