Skip to content

Instantly share code, notes, and snippets.

@aherve
Created April 12, 2016 14:12
Show Gist options
  • Select an option

  • Save aherve/d6743bfc76141447bec04682ceaff22c to your computer and use it in GitHub Desktop.

Select an option

Save aherve/d6743bfc76141447bec04682ceaff22c to your computer and use it in GitHub Desktop.
######### READ ENV VARIABLES ###########
echo "reading env variables"
eval `./jsonenv.py < $PAYLOAD_FILE`
eval `./jsonenv.py < $CONFIG_FILE`
######### DOWNLOAD FILE ###########
echo "downloading"
aws s3 cp s3://$S3_INPUT_BUCKET/$S3_INPUT_DIRNAME/$S3_INPUT_FILENAME ./orig.pdf
############ CONVERT FILE #######
echo "converting file"
convert -density 100 ./orig.pdf \
-fill "rgba(0,0,0,0.1)" \
-pointsize 40 \
-gravity center -draw "rotate -30 text 5,0 '$WATERMARK_TEXT'" \
./result.pdf
############ REUPLOAD ###########
echo "uploading"
aws s3 cp ./result.pdf s3://$S3_DEST_BUCKET/$S3_DEST_DIRNAME/$S3_DEST_FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment