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
DWG2PDFmodule - 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" 指用于 DWG 转 PDF 的引擎文件 "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_PATHenvironment variable.shexport LD_LIBRARY_PATH=/dwgtopdf/linux:$LD_LIBRARY_PATH - Mac (x64): Add the dwg2pdf engine file path to the
DWG_ENGINE_PATHenvironment variable.shexport DWG_ENGINE_PATH=/dwgtopdf/mac
Run the Sample
After configuration is complete, see Run Samples for instructions on running the sample.