Blog Post

Using Third Party CAD Converters in Combination with the Muhimbi PDF Converter

Clavin Fernandes
Illustration: Using Third Party CAD Converters in Combination with the Muhimbi PDF Converter

Muhimbi’s range of server based PDF Conversion products 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) or an affordable third party utility named Any DWG to PDF Converter (US$ 150 per server, contact us 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 or Muhimbi PDF Converter for SharePoint. During installation please pay close attention to Chapter 2 of the included Installation and Administrating Guide.

  2. Download and install Any DWG to PDF Converter Pro. 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:

/Hide Hide the result window and the message dialog (Always specify this switch)
/PDFWidth PDF width in millimeters, e.g. /PDFWidth 210
/PDFHeight PDF height in millimeters, e.g. /PDFHeight 297
/DisableAutoSize Disable the “Automatically adjust the page size based on the drawing” option
/PDFMargin Margin in millimeters, e.g. /PDFMargin 5
/PDFColor Output color, available values: TrueColors, GrayScale, BlackWhite.

* TrueColors: True Colors
* GrayScale: Gray-scale
* BlackWhite: Black/White

For example: /PDFColor TrueColors
/PDFQuality PDF quality, available values: Normal, Medium, High, Highest. e.g. /PDFQuality Highest
/OutMode Output 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
/OutLayout Output 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
/OutArea Output area, available values: ZoomExtents, LastSavedView.

* ZoomExtents: Zoom extents
* LastSavedView: Last saved view of drawing

For example: /OutArea ZoomExtents
/LineWidth Line width, available values: Default, CADDefault, ByColor.

* Default: Default width
* CADDefault: Use the CAD default line weight
* ByColor: Custom by color

For example: /LineWidth CADDefault
/LineScale Set the line width scale, e.g. /LineScale 4
/PDFAuthor Set the PDF author, e.g. /PDFAuthor author name
/PDFTitle Set the PDF title, e.g. /PDFTitle title
/PDFSubject Set the PDF subject, e.g. /PDFSubject subject
/PDFKeyword Set the PDF keywords, e.g. /PDFKeyword keywords1, keywords2
/DisablePDFBookmark Disable the “Create PDF bookmark” option
/DisableFillTTF Disable the “Fill TTF font in the drawing” option
/DisableOutImage Disable 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 from DWG Tool Software.

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}"/>
/r Invoke the command line and not GUI conversion
/ad Fit conversion to the page
/f 105 Specify conversion to PDF
/d Specify PDF output name and location

Any questions? Leave a comment below or contact us.

Author
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

Share post
Free trial Ready to get started?
Free trial