Load CAD document with options

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

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

Specify layouts to be converted

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

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 sample shows how to convert CAD document and specify width and height

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);