Babar Raza January 7, 2015one Comment

Convert Multiple Layouts of AutoCAD Drawings to PDF & Image Formats with Aspose.Imaging for .NET 2.7.0

Convert Multiple Layouts of AutoCAD Drawings to PDF & Image Formats with Aspose.Imaging for .NET 2.7.0

January 7, 2015
Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose.Imaging for .NET 2.7.0 has been released and we are pleased to announce that this month’s release contains many useful improvements and features. Most worth mentioning feature is the support for DWG 2005 revision 16.1, 2010 revision 18.0 and 2013 revision 19.0 AutoCAD formats. Please refer to the release notes of Aspose.Imaging for .NET 2.7.0 for a full list of bug fixes and improvements along with sample code snippets to the newly added features. If you are planning to upgrade the Aspose.Imaging for .NET API to the latest revision, we would strongly suggest you to check the Public API Change section to know what has been changed in the API since your current version.

While you are downloading the latest build, here is a look at the biggest features in this release.

Support for Multiple Layout Rendering

As you are already aware that Aspose.Imaging for .NET API can load AutoCAD drawings for possible conversion to PDF and raster image formats. With this release, the API has extended it’s support for the said conversion by allowing the users to select multiple layouts from a given DWG or DXF drawing, and render them to PDF or raster image formats. The API has exposed the CadRasterizationOptions.Layouts property of type string[] so you may specify more than one layouts at a time. While specifying multiple layouts for the CadRasterizationOptions.Layouts property, the resultant PDF and TIFF image would have multiple pages, GIF image would have multiple frames and PSD format would have multiple layers, where each page/frame/layer represents an individual AutoCAD layout. In case any other image format such as PNG, BMP, JPEG is selected to store the result then the API will render only the default layout; that is “Model”.

Tracking of CAD Rendering Process

The CAD to PDF and CAD to raster image conversion can take some time to complete and may fail after some execution due to any problem in the input CAD file. Instead of wondering what could have been happening during the process, you may simply use the Aspose.Imaging’s tracking API to know the status of the conversion process. Aspose.Imaging for .NET 2.7.0 has introduced a series of new classes and a few helping enumeration fields to assist with the tracking of CAD rendering process for possible problems such as following.

  • Missing or corrupted header information.
  • Missing layout information.
  • Missing block entities.
  • Missing dimension styles.
  • Missing styles.

Support for PNG & GIF Transparent & Background Colors

Previously, Aspose.Imaging allowed to set the transparency color for PNG format. With this release, the API has extended it’s support for the GIF image, and have improved the public API to make the usability even simpler by exposing the relevant properties to the RasterImage class.

Here is the simplest code to set the transparent & background color for the RasterImage object and save the result in PNG format.


//Load the source image (any format) in an instance of RasterImage
using (RasterImage image = (RasterImage)Image.Load(sourceImage))
{
    //Set the background color for the image
    image.BackgroundColor = Color.White;

    //Set the transparent color for the image
    image.TransparentColor = Color.Black;

    //Set the HasTransparentColor & HasBackgroundColor properties to true
    image.HasTransparentColor = true;
    image.HasBackgroundColor = true;

    //Save the image on disc in PNG format
    image.Save(outputImage, new PngOptions());
}

As always we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.Imaging forum for a chat.

Join the Conversation

1 Comment

Leave a comment

Posted inAspose.Imaging Product Family, Babar Raza
 

Related Articles