Advertisement
Guest User

svg_split.sh

a guest
Jan 14th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.57 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. if [ -z $1 ] ; then
  4.     echo "Usage: $0 [FILE]"
  5.     exit 1
  6. else
  7.     FILE=$1
  8. fi
  9.  
  10. for ID in $(grep -o "id=\".*\"" ${FILE} | cut -d\" -f2 | grep "^g"); do
  11.     OUTPUT="${ID}.pdf"
  12.     echo "Exporting area $ID to $OUTPUT..."
  13.     inkscape -z -f ${FILE} --export-text-to-path \
  14.         --export-ignore-filters --export-id=${ID} \
  15.         --export-id-only --export-pdf=${OUTPUT}
  16. done
  17.  
  18.  
  19. find . -name "*.pdf" -size +4k | while read PDF; do
  20.     SVG="$(basename ${PDF} .pdf).svg"
  21.     echo "Converting from <${PDF}> to <${SVG}>..."
  22.     pdf2svg ${PDF} ${SVG}
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement