Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Distiller-like pdf creator script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
LGW
n00b
n00b


Joined: 02 Oct 2002
Posts: 60

PostPosted: Fri Feb 04, 2005 12:21 pm    Post subject: Distiller-like pdf creator script Reply with quote

I needed a simple way to create PDFs from programs that can't create pdf files, but can print to file or save .eps.

so I came up with this (might be possible to write a better script, though ;))

1. create a folder
2. create two subfolders, "in" and "out" - out takes the pdfs, in the backups of the files that are pushed into
3. create a script in the folder:

Code:

#!/bin/bash
while true; do

if [ `find ./ -name "*.ps" -maxdepth 1 | wc -l` != 0 ]; then
  find ./ -name "*.ps" -maxdepth 1 -type f -print | while read i
   do
    DATUM=$(date +%s)
    DATEI=${i:2}

    ps2pdf $i out/${DATUM}_${DATEI}.pdf
    mv $i in/${DATUM}_${DATEI}
    acroread out/${DATUM}_${DATEI}.pdf &
  done
fi

if [ `find ./ -name "*.eps" -maxdepth 1 | wc -l` != 0 ]; then
  find ./ -name "*.eps" -maxdepth 1 -type f -print | while read i
   do
    DATUM=$(date +%s)
    DATEI=${i:2}

    epstopdf $i --outfile out/${DATUM}_${DATEI}.pdf
    mv $i in/${DATUM}_${DATEI}
    acroread out/${DATUM}_${DATEI}.pdf &
  done 
fi

sleep 10;
done


now, execute the script in background, and store the .ps or .eps file in the folder (not in "in", this just takes the backup copies when pdf is generated)

acroread could be replaced by your favourite tool...

Maybe there's a better solution for this, and it could be enhanced by multiple file types, but it was fast and easy and works for me :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum