Load CAD document with options

GroupDocs.Conversion provides the CadLoadOptions class to give you control over how the source CAD document will be processed. The following options could be set:

  • setFormat allows you to the source document format explicitly with this property. Available options are: Dxf, Dwg, Dgn, Dwf, Stl, Ifc, Plt, Igs, Dwt.
  • setWidth sets the desired page width.
  • setHeight sets the desired page height.
  • setLayoutNames specifies which CAD layout to be converted.

Specify layouts to be converted

The following code snippet shows how to convert a CAD document and convert only certain layouts:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
import com.groupdocs.conversion.options.load.CadLoadOptions;
...
CadLoadOptions loadOptions =  new CadLoadOptions();
loadOptions.setLayoutNames(new  String[]{ "Layout1", "Layout3" });

Converter converter = new Converter("with_layers_and_layouts.dwg", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

Specify width and height

The following code snippet shows how to convert a CAD document and specify the width and height:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.load.CadLoadOptions;
import com.groupdocs.conversion.options.convert.PdfConvertOptions;
...
CadLoadOptions loadOptions =  new CadLoadOptions();
loadOptions.setWidth(1920);
loadOptions.setHeight(1080);

Converter converter = new Converter("with_layers_and_layouts.dwg", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);