User Tools

Site Tools


kicad:svg2pdf-d

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
kicad:svg2pdf-d [2013/06/29 23:16]
mithat
kicad:svg2pdf-d [2013/06/29 23:28] (current)
mithat
Line 24: Line 24:
 # Requires inkscape, zenity. # Requires inkscape, zenity.
  
-EXT=.svg+EXT_IN=.svg 
 +EXT_OUT=.pdf
 OPTIONS=""​ OPTIONS=""​
  
Line 30: Line 31:
  
 # Make list of files to be processed. # Make list of files to be processed.
-FILES=$(ls -1 *${EXT} 2>/​dev/​null) || { zenity --title "​$SCRIPTNAME"​ --warning --text "<​b>​Nothing to convert!</​b>​+FILES=$(ls -1 *${EXT_IN} 2>/​dev/​null) || { zenity --title "​$SCRIPTNAME"​ --warning --text "<​b>​Nothing to convert!</​b>​
  
-No *${EXT} files found.";​ exit 1; }+No *${EXT_IN} files found.";​ exit 1; }
  
 # Get confirmation from user to continue. # Get confirmation from user to continue.
Line 47: Line 48:
 for file in $FILES for file in $FILES
 do do
-    base=$(basename $file ${EXT}) +    base=$(basename $file ${EXT_IN}) 
-    echo "​${file} --export-pdf=${base}.pdf" >> $CMDFILE+    echo "​${file} --export-pdf=${base}${EXT_OUT}" >> $CMDFILE
 done done
  
Line 60: Line 61:
 # Since inkscape exits with 0 even with errors, we need to explicitly check # Since inkscape exits with 0 even with errors, we need to explicitly check
 # for conversion before deleting originals. # for conversion before deleting originals.
-rv=0 
 not_deleted=""​ not_deleted=""​
 for file in $FILES for file in $FILES
 do do
-    base=$(basename $file ${EXT}) +    base=$(basename $file ${EXT_IN}) 
-    if [[ -f ${base}.pdf ]]; then+    if [[ -f ${base}${EXT_OUT} ​]]; then
         rm $file         rm $file
     else     else
         not_deleted="​$not_deleted         not_deleted="​$not_deleted
 $file" $file"
-        rv=1 
     fi     fi
 done done
Line 79: Line 78:
       --text "<​b>​The following files were not deleted:</​b>​       --text "<​b>​The following files were not deleted:</​b>​
 $not_deleted"​ $not_deleted"​
 +    exit 1
 fi fi
- 
-exit $rv 
 </​file>​ </​file>​
kicad/svg2pdf-d.txt · Last modified: 2013/06/29 23:28 by mithat