[solved] dxf to pdf
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
[solved] dxf to pdf
QCAD 3.25.2 is running on my iMac with macOS Catalina (10.15.7).
I would like to convert all dxf in a folder to pdf via batch or script. How do I have to proceed under macOS?
Please step-by-step, as my Unix and script knowledge is only rudimentary.
I would like to convert all dxf in a folder to pdf via batch or script. How do I have to proceed under macOS?
Please step-by-step, as my Unix and script knowledge is only rudimentary.
Ich will nicht streiten. Ich will nur deutlich machen, dass ich Recht habe und DU NICHT.
Re: dxf to pdf
You can find the dwg2pdf command line tool under macOS under /Applications/QCAD-Pro.app/Contents/Resources.
To convert all files in a directory, you'd typically run a bash script that calls dwg2pdf for all files in the folder. Here's an example bash script that converts all DXF files in a directory to PDF size A4 (-p A4), auto fitting to page (-a), overwriting existing files (-f):
To convert all files in a directory, you'd typically run a bash script that calls dwg2pdf for all files in the folder. Here's an example bash script that converts all DXF files in a directory to PDF size A4 (-p A4), auto fitting to page (-a), overwriting existing files (-f):
Code: Select all
for file in *.dxf
do
/Applications/QCAD-Pro.app/Contents/Resources/dwg2pdf -a -p A4 -f "$file"
done
Re: dxf to pdf
Many Thanks. The procedure works for me if I set the path manually in the terminal (cd) and then enter the program loop you mentioned ("for i = ...") in the terminal window. So far so good.
Then I tried to create an executable shell script ("#! / Bin / sh" and "chmod 755" filename ") according to instructions found on the web. Unfortunately, the path does not change, it is always the path under which the executable script was created used.
Although it is no longer a QCAD problem, I still hope to find help here.
Then I tried to create an executable shell script ("#! / Bin / sh" and "chmod 755" filename ") according to instructions found on the web. Unfortunately, the path does not change, it is always the path under which the executable script was created used.
Although it is no longer a QCAD problem, I still hope to find help here.
Ich will nicht streiten. Ich will nur deutlich machen, dass ich Recht habe und DU NICHT.
Re: dxf to pdf
You'd typically create the script in a folder that is in your PATH environment variable and execute it from wherever the folder with your files is.
For example:
- Save your bash script to /Users/yourname/bin/alldwg2pdf.sh
- Make it executable:
- Add this to your ~/.profile file:
From now on, your script will be found from any directory in any new Terminal.
- Start a new Terminal
- cd to the path where your drawings are:
- run the script:
For example:
- Save your bash script to /Users/yourname/bin/alldwg2pdf.sh
- Make it executable:
Code: Select all
chmod a+x /Users/yourname/bin/alldwg2pdf.sh
Code: Select all
export PATH="/Users/yourname/bin:$PATH"
- Start a new Terminal
- cd to the path where your drawings are:
Code: Select all
cd /Users/yourname/mydrawings
Code: Select all
alldwg2pdf.sh
Re: dxf to pdf
Thanks again.
After some troubleshooting, I got the script to work.
I got stuck at your "./alldxf2pdf.sh".
It should read: "alldxf2pdf.sh".
After some troubleshooting, I got the script to work.
I got stuck at your "./alldxf2pdf.sh".
It should read: "alldxf2pdf.sh".
Last edited by TSG on Fri Oct 02, 2020 11:09 am, edited 1 time in total.
Ich will nicht streiten. Ich will nur deutlich machen, dass ich Recht habe und DU NICHT.
Re: dxf to pdf
Yes, I've corrected it in case anyone else reads this, thanks.
Re: dxf to pdf
I've added a second for-do-loop in the script:
for file in *.dwg
do
/Applications/QCAD-Pro.app/Contents/Resources/dwg2pdf -a -p A4 -f "$file"
done
With this dwg are also converted to pdf.
for file in *.dwg
do
/Applications/QCAD-Pro.app/Contents/Resources/dwg2pdf -a -p A4 -f "$file"
done
With this dwg are also converted to pdf.
Ich will nicht streiten. Ich will nur deutlich machen, dass ich Recht habe und DU NICHT.
Re: dxf to pdf
For the record, this would also work:
Note: Make sure that the file names don't contain spaces.
Code: Select all
for file in *.dxf *.dwg