Skip to content

DWG to PDF Sample: Configuration and Run Guide ​

This guide explains how to configure and run the Foxit PDF SDK DWG to PDF sample in a Java environment. To learn how to perform conversion through the API, see DWG to PDF.

System Requirements ​

  • Platforms: Windows, Linux (x86 and x64), Mac (x64)
  • Languages: C, C++, Java, C#, Python, Objective-C, Node.js, Go
  • License: A license key that includes the DWG2PDF module
  • SDK versions:
    • Foxit PDF SDK 10.0+
    • Foxit PDF SDK (Go) 11.0

The versions above are the minimum SDK versions that first introduced the features described in this guide for each listed language. Refer to the package documentation and release notes for the latest versions and platform differences.

Obtaining DWG to PDF Engine Files ​

Request a trial through the Foxit Developer Hub, or contact your Foxit technical support team and sales representatives to obtain the DWG to PDF engine package.

Sample Run Guide ​

Configure the Engine File Path ​

Before running the dwg2pdf sample in \examples\simple_demo\dwg2pdf, specify the dwg2pdf engine file path in the sample code. Example:

java
// "engine_path" is the path to the DWG-to-PDF engine file "dwg2pdf". 
private static String engine_path = "D:/dwgtopdf/win";

Environment Variable Configuration on Linux/Mac

On Linux (x86 and x64) and Mac (x64), configure environment variables before running the sample:

  • Linux (x86 and x64): Add the dwg2pdf engine file path to the LD_LIBRARY_PATH environment variable.
    sh
    export LD_LIBRARY_PATH=/dwgtopdf/linux:$LD_LIBRARY_PATH
  • Mac (x64): Add the dwg2pdf engine file path to the DWG_ENGINE_PATH environment variable.
    sh
    export DWG_ENGINE_PATH=/dwgtopdf/mac

Run the Sample ​

After configuration is complete, see Run Samples for instructions on running the sample.