Using third party CAD converters effectively

Using third party CAD converters effectively

Muhimbi’s range of server based PDF Conversion products(opens in a new tab) has had the ability to convert AutoCAD (DXF and DWG) files for quite some time. It works really well, but as it doesn’t rely on AutoCAD being present it uses custom code to carry out the conversion. As the AutoCAD format is constantly evolving, certain features are not supported (e.g. 3D solids, bitmaps or embedded OLE objects).

The AutoCAD converter that comes with our software is improved all the time, however if you need a certain unsupported feature right now, and cannot wait, then you may want to consider adding a third party AutoCAD plug-in to your copy of the Muhimbi PDF Converter as described below. As a result you will be able to achieve perfect conversion fidelity when converting DXF and DWG files from your Java, PHP, Ruby, .NET or SharePoint solution.

The easiest way to add third party plug-ins to the Muhimbi PDF Converter is to make use of our generic Command Line Converter, which allows any third party product that can be controlled via the command line to be fully integrated with the PDF Converter, in a completely transparent manner, without losing any of the PDF Converter’s other features such as watermarking, merging and encryption.

Some of our existing customers already use this approach using either VisConvert (part of Siemens Teamcenter(opens in a new tab)) or an affordable third party utility named Any DWG to PDF Converter(opens in a new tab) (US$ 150 per server, contact us(opens in a new tab) for a discount code). A Google search reveals other command line based DWG to PDF converters, but a quick evaluation reveals that the quality of many of those is questionable at best. At the bottom of this post you will find an alternative that some of our customers are using.

In the example below we’ll show how to integrate AnyDWG into the Muhimbi PDF Converter.

  1. Download and install the Muhimbi PDF Converter Services(opens in a new tab) or Muhimbi PDF Converter for SharePoint(opens in a new tab). During installation please pay close attention to Chapter 2 of the included Installation and Administrating Guide(opens in a new tab).
  2. Download and install Any DWG to PDF Converter Pro(opens in a new tab). In this example we assume it is installed in the default location.
  3. Open Muhimbi.DocumentConverter.Service.exe.config in your favourite text editor (notepad works as well). A handy shortcut to the configuration / installation folder that holds this config file can be found in the Muhimbi Document Converter Windows Start Menu group.
  4. Search for “CAD based formats” and remove or comment out the entire XML element.
  5. Search for “CommandLineConverter” and replace it with the following, don’t forget to remove the XML comments (<!--…. –>)
    <add key="CAD Converter (CL)"
    description="3rd Party CAD Converter"
    fidelity="Full"
    supportedExtensions="dxf,dwg"
    supportedOutputFormats="pdf"
    type="Muhimbi.DocumentConverter.WebService.CommandLineConverter,
    Muhimbi.DocumentConverter.WebService, Version=1.0.1.1, Culture=neutral,
    PublicKeyToken=c9db4759c9eaad12"
    parameter="C:\Program Files (x86)\Any DWG to PDF Converter Pro\dp.exe |
    /InFile {0} /OutFile {1} /PDFColor GrayScale /PDFQuality High /OutMode AlltoOne /Hide"/>
  6. Save the configuration file.
  7. If you have any custom SHX fonts then please place these in the Fonts folder under the AnyDWG installation directory. On our test system that folder is located at C:\Program Files (x86)\Any DWG to PDF Converter Pro\Fonts.
  8. Restart the Muhimbi Document Converter Service using the Services Management Console or using the command prompt:
    Net stop "Muhimbi Document Converter Service"
    Net start "Muhimbi Document Converter Service"
  9. Validate the converters as described here and check that CAD Converter (CL) validates.

For more details about configuring 3rd party converters see this blog post.

Although AnyDWG integrates seamlessly with the Muhimbi PDF Converter, any CAD settings in our config file or Web Services based Object Model are ignored. Fear not as in case of AnyDWG most of the options can be added to the command line.

Listed below is an abstract of the AnyDWG help file that deals with command line options:

/HideHide the result window and the message dialog (Always specify this switch)
/PDFWidthPDF width in millimeters, e.g. /PDFWidth 210
/PDFHeightPDF height in millimeters, e.g. /PDFHeight 297
/DisableAutoSizeDisable the "Automatically adjust the page size based on the drawing" option
/PDFMarginMargin in millimeters, e.g. /PDFMargin 5
/PDFColorOutput color, available values: TrueColors, GrayScale, BlackWhite. * TrueColors: True Colors * GrayScale: Gray-scale * BlackWhite: _Black/White_For example: /PDFColor TrueColors
/PDFQualityPDF quality, available values: Normal, Medium, High, Highest. e.g. /PDFQuality Highest
/OutModeOutput mode option, available values: ByLayout, ByDrawing, AlltoOne. * ByLayout: One PDF per layout * ByDrawing: One PDF per drawing * AlltoOne: _All drawings combined into on PDF file_For example: /OutMode ByLayout
/OutLayoutOutput layout, available values: All, Model, Paper, Active, ByName:layoutname: * All: All layouts * Model: Model space * Paper: All paper spaces * Active: Last active layout * ByName: Ouput by layout name For example:/OutLayout Paper or /OutLayout ByName:Layout1
/OutAreaOutput area, available values: ZoomExtents, LastSavedView. * ZoomExtents: Zoom extents * LastSavedView: _Last saved view of drawing_For example: /OutArea ZoomExtents
/LineWidthLine width, available values: Default, CADDefault, ByColor. * Default: Default width * CADDefault: Use the CAD default line weight * ByColor: _Custom by color_For example: /LineWidth CADDefault
/LineScaleSet the line width scale, e.g. /LineScale 4
/PDFAuthorSet the PDF author, e.g. /PDFAuthor author name
/PDFTitleSet the PDF title, e.g. /PDFTitle title
/PDFSubjectSet the PDF subject, e.g. /PDFSubject subject
/PDFKeywordSet the PDF keywords, e.g. /PDFKeyword keywords1, keywords2
/DisablePDFBookmarkDisable the "Create PDF bookmark" option
/DisableFillTTFDisable the "Fill TTF font in the drawing" option
/DisableOutImageDisable the "Export Image/Excel file in the drawing" option

AnyDWG is far from the only command line CAD converter out there, it is simply one that we have experience with. Due to the complexity of DWG/DWF files, different converters will work differently depending on what has been included in the file (embedded objects, 2D/3D views, etc) and what you want the PDF to include. If AnyDWG does not meet you specific conversion needs, another third party product that may help is the Acme CAD Converter(opens in a new tab) from DWG Tool Software(opens in a new tab).

The setup steps are the same as for AnyDWG, except for the installation details for the third party converter and the specifics of the command line. There are a number of command line switches, but in this example we use the default options that will create a basic conversion:

<add key="CAD Converter (CL)"
description="3rd Party CAD Converter"
fidelity="Full"
supportedExtensions="dxf,dwg"
supportedOutputFormats="pdf"
type="Muhimbi.DocumentConverter.WebService.CommandLineConverter,
Muhimbi.DocumentConverter.WebService, Version=1.0.1.1, Culture=neutral,
PublicKeyToken=c9db4759c9eaad12"
parameter="C:\Program Files (x86)\Acme CAD Converter\AcmeCADConverter.exe |
/r /ad /f 105 /d {1} {0}"/>
/rInvoke the command line and not GUI conversion
/adFit conversion to the page
/f 105Specify conversion to PDF
/dSpecify PDF output name and location

Any questions? Leave a comment below or contact us(opens in a new tab).

Clavin Fernandes

Clavin Fernandes

Developer Relations and Support Services

Clavin is a Microsoft Business Applications MVP who supports 1,000+ high-level enterprise customers with challenges related to PDF conversion in combination with SharePoint on-premises Office 365, Azure, Nintex, K2, and Power Platform mostly no-code solutions.

Explore related topics

FREE TRIAL Ready to get started?