We are pleased to announce the release of Aspose.CAD for Java 1.0.0. This is a new addition to Aspose for Java APIs and allows you to work with CAD formats including DWG and DXF formats. Aspose.Imaging for Java also supports CAD formats but these formats will be removed from Aspose.Imaging for Java in the next three months and all features related to CAD formats will be the part of Aspose.CAD only.

This release of Aspose.CAD for Java supports converting DWG and DXF formats to PDF and raster image formats. Converting CAD layers and layouts to PDF and raster image formats has also been supported by this release. You can also remove entities from DWG and DXF documents.

Convert CAD to PDF using Java

Aspose.CAD for Java allows you to convert CAD drawings to PDF format. com.aspose.cad.Image.load method can be used to load CAD drawings, com.aspose.cad.imageoptions.CadRasterizationOptions can be used to set vector rasterization options, com.aspose.cad.imageoptions.PdfOptions can be used to set PDF options and com.aspose.cad.Image.save method can be used to save output PDF e.g.

Convert CAD Formats to Raster Image in Java

Aspose.CAD for Java allows you to convert CAD drawings to raster image formats. com.aspose.cad.Image.load method can be used to load CAD drawings, com.aspose.cad.imageoptions.CadRasterizationOptions can be used to set vector rasterization options, com.aspose.cad.ImageOptionsBase can be used to set image options and com.aspose.cad.Image.save method can be used to save output image e.g.

Remove Entities from CAD Documents

Aspose.CAD for Java allows you to remove specific entities from CAD drawings. com.aspose.cad.Image.load method can be used to load CAD drawings, com.aspose.cad.fileformats.cad.CadImage.getEntities() can be used to loop through each entity and com.aspose.cad.fileformats.cad.CadImage. removeEntity can be used to remove any entity e.g.

com.aspose.cad.fileformats.cad.CadImage image = (com.aspose.cad.fileformats.cad.CadImage) com.aspose.cad.Image
		.load("Input.dwg");

for (int i = 0; i < image.getEntities().length; i++) {
	CadBaseEntity baseEntity = image.getEntities()[i];
	if (baseEntity.getClass() == com.aspose.cad.fileformats.cad.cadobjects.CadArc.class) {
		com.aspose.cad.fileformats.cad.cadobjects.CadArc arc = (com.aspose.cad.fileformats.cad.cadobjects.CadArc) baseEntity;
		if (arc.getCenterPoint().getX() > 1e10) {
			// cadImage.RemoveEntityAt(i);
			image.removeEntity(baseEntity);
			i--;
		}
	}
}

image.updateSize();

// Create an instance of CadRasterizationOptions and set its various
// properties
com.aspose.cad.imageoptions.CadRasterizationOptions rasterizationOptions = new com.aspose.cad.imageoptions.CadRasterizationOptions();
rasterizationOptions.setBackgroundColor(com.aspose.cad.Color
		.getWhite());
rasterizationOptions.setLayouts(new String[] { "Model" });

rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);

rasterizationOptions.setCenterDrawing(true);
// Create an instance of PdfOptions
com.aspose.cad.imageoptions.PdfOptions pdfOptions = new com.aspose.cad.imageoptions.PdfOptions();
// Set the VectorRasterizationOptions property
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

image.save("Output.pdf", pdfOptions);

Other Important Features

Following is a list of some important features included in this release.

To view a complete list of new features and to download the latest release, please visit Aspose.CAD for Java 1.0.0 page in downloads section.

Aspose.CAD for Java Resources

The resources, you may need to accomplish your tasks: