Convert CF2 to BMP in C#

CAD CF2 file that contains 3D package designs or other model data; can be processed and cut by a CAD/CAM machine, such as a die cutting device; saved in an open format, which may be recognized by multiple hardware devices and software programs. In certain cases, we may need to export drawings from CF2 files to BMP documents programmatically. Such conversions allow sharing of drawings in a portable format. In this article, we will see how to convert a CF2 file to a BMP in C#.

The following topics shall be covered in this article:

  1. C# CF2 to BMP Converter – Free Download
  2. Steps to Convert CF2 File to BMP Document
  3. Convert CF2 to BMP Programmatically
  4. Export CF2 to BMP with Options

C# CF2 to BMP Converter – Free Download

Convert a CF2 file to a BMP file, we will be using the Aspose.CAD for .NET. It allows creating, editing, and manipulating CF2 files and several other file formats.

The API’s base class for all types of drawings is the Image class.A CF2 image is represented by the Cf2Image class.The CadRasterizationOptions class allows us to modify the [PageWidth] and [PageHeight] properties.The BMP options can be specified using the API’s BmpOptions class.

Please either download the DLL of the API or install it using NuGet.

PM> Install-Package Aspose.CAD

How to Convert CF2 File to BMP using C#

We can easily convert a CF2 file to a BMP document using Aspose.CAD for .NET by following the steps given below:

  • Load a CF2 drawing file.
  • Save CF2 as BMP.

Now, let’s see how to perform these steps in C# to convert a CF2 file to a BMP document.

Convert CF2 to BMP Programmatically in C#

Please follow the steps given below to convert a CF2 to a BMP:

  1. Load an input CF2 file using the Image class.
  2. Create an instance of the BmpOptions class.
  3. Call Save() method to save it as a BMP. It takes the output BMP file path and BmpOptions as arguments.

The following code sample shows how to convert a CF2 file to a BMP document using C#.

Export CF2 to BMP with Options in C#

We can specify BMP save options while converting a CF2 file to a BMP document by following the steps given below:

  1. Load an input CF2 file using the Image class.
  2. Create an instance of the CadRasterizationOptions class.
  3. Specify the page height and width.
  4. Create an instance of the BmpOptions class.
  5. Set the VectorRasterizationOptions property as CadRasterizationOptions.
  6. Call Save() method to save it as a BMP. It takes the output BMP file path and BmpOptions as arguments.

The following code sample shows how to specify the page height and width while saving a CF2 file as a BMP document using C#.

Get Free Temporary License

You can get a free temporary license to try the library without evaluation limitations.

Conclusion

In this article, we have learned how to:

  • load an existing CF2 drawing file;
  • specify page height and width;
  • define save options;
  • save CF2 as a BMP in C#.

A CF2 file is a three-dimensional design that can be processed by CAD/CAM software and hardware devices. For example, it may store the shape and design of a cardboard box before it is folded. Since CF2 files are saved in a universal format, they may be imported and exported by several different programs. You can learn more about Aspose.CAD for .NET API using the documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also