External tools
Requirements by operation
| Public operation | Result | Required commands |
|---|---|---|
Dwg::thumbnail(...)->extract() | Embedded BMP, PNG, or WMF preview | LibreDWG dwgbmp |
Dwg::toDxf(...)->convert() | ASCII DXF | LibreDWG dwg2dxf |
Dwg::toJson(...)->convert() | LibreDWG structural JSON | LibreDWG dwgread with JSON output |
Dwg::entities(...)->read() | Entity data and diagnostics | LibreDWG dwgread with JSON output |
Dwg::version(...) | Stored DWG format | None |
Dwg::info(...)->read() | Basic drawing information | LibreDWG dwgread with JSON output |
Dwg::layers(...)->read() | Layer data Collection | LibreDWG dwglayers with --flags and, for onlyOn(), --on |
Dwg::toImage(...)->convert() | PNG, JPEG, or WebP preview | LibreDWG dwg2dxf, LibreOffice 7.4+ soffice, ImageMagick 7 magick |
Only image previews require LibreOffice and ImageMagick.
LibreDWG
For installation, follow the official LibreDWG repository. Use a maintained, security-patched build that provides the command required by your operation.
Check the version and available options for the commands you use.
dwgbmp --version
dwg2dxf --version
dwgread --version
dwgread --help
dwglayers --version
dwglayers --helpThe dwgread help must list -O, --format, and -o, with JSON as a distinct output format. Check dwglayers --help for --flags and, if you use onlyOn(), --on.
If they are not on PATH, set their absolute paths:
LIBREDWG_DWGBMP=/absolute/path/to/dwgbmp
LIBREDWG_DWG2DXF=/absolute/path/to/dwg2dxf
LIBREDWG_DWGREAD=/absolute/path/to/dwgread
LIBREDWG_DWGLAYERS=/absolute/path/to/dwglayersConfirm which security fixes your build includes. A version string such as 0.14 omits the patch level.
LibreOffice
toImage() requires LibreOffice 7.4 or later for WebP export support.
Ubuntu and Debian
sudo apt update
sudo apt install libreoffice
soffice --versionConfirm that the installed version is 7.4 or later.
RHEL and Fedora
First check whether your enabled repositories provide LibreOffice 7.4 or later. If they do, install the distribution package and verify it:
sudo dnf install libreoffice
soffice --versionRHEL installations do not all expose the same package set. If that command is unavailable, download the Red Hat-family RPM archive from the official LibreOffice download page, extract it, install the RPMs from its RPMS directory, and configure the resulting soffice absolute path.
Windows
Install LibreOffice from the official download page. Point the package to the console launcher, normally:
DWG_CONVERTER_LIBREOFFICE="C:/Program Files/LibreOffice/program/soffice.com"The GUI launcher soffice.exe can report success without producing a file. Use a short absolute path for temporary_directory to avoid Windows path-length failures.
ImageMagick
toImage() runs the ImageMagick 7 magick command directly. You can leave PHP's ext-imagick uninstalled.
Ubuntu and Debian
Check your distribution's package version before installing. Ubuntu 24.04's imagemagick package provides ImageMagick 6, so sudo apt install imagemagick there does not provide the required ImageMagick 7 magick command.
When your repository provides ImageMagick 7, install it and verify the result:
sudo apt install imagemagick
magick --versionOtherwise use the ImageMagick 7 AppImage from the official download page or follow the official source installation guide. Configure the downloaded or installed executable's absolute path if it is not on PATH.
RHEL and Fedora
Likewise, verify the repository's major version before relying on its package:
sudo dnf install ImageMagick
magick --versionIf the repository installs ImageMagick 6 or does not provide magick, use the official ImageMagick 7 AppImage or source installation linked above.
Windows
Use the official ImageMagick installer, then verify magick.exe:
magick --versionIf it is not on PATH, set:
DWG_CONVERTER_IMAGEMAGICK="C:/Program Files/ImageMagick-7.x.x-Q16-HDRI/magick.exe"In every environment, magick --version must report ImageMagick 7. Review ImageMagick's security policy before processing untrusted files.