Calling QCAD command line tools from PHP

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
User avatar
andrew
Site Admin
Posts: 9058
Joined: Fri Mar 30, 2007 6:07 am

Calling QCAD command line tools from PHP

Post by andrew » Tue Jul 14, 2015 10:01 am

From a QCAD user:
How can I call dwg2pdf, dwg2bmp or dwg2svg from a PHP script running on a server?

User avatar
andrew
Site Admin
Posts: 9058
Joined: Fri Mar 30, 2007 6:07 am

Re: Calling QCAD command line tools from PHP

Post by andrew » Tue Jul 14, 2015 10:08 am

The QCAD command line tools can be used to convert DWG or DXF drawings to bitmap formats (BMP, JPEG, PNG, TIFF, ...), PDF or SVG. You can also develop your own QCAD command line tools to create, manipulate, analyse or convert drawings.

To install QCAD on a server, you can simply copy the .tar.gz or .zip archive to the server and extract it there or copy the extracted files to the server.

You can then call any QCAD command line tool from PHP using the PHP function exec:
$output = null;
exec("/path/to/qcad/dwg2bmp -width=1024 -height=768 -f -o /tmp/output.png /tmp/input.dwg 2>/dev/null", $output);
If your server is running Windows, you'd have to use the Windows path notation instead.

For more information about QCAD command line tools, please refer to:
http://www.qcad.org/en/qcad-documentati ... line-tools

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”