From 1984e2600a48fde220f70042f9baf4d08898c60d Mon Sep 17 00:00:00 2001 From: Sagar Karandikar Date: Sat, 19 May 2018 19:09:37 +0000 Subject: [PATCH] pdfs to images script --- docs/tools/pdfs_to_images.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 docs/tools/pdfs_to_images.sh diff --git a/docs/tools/pdfs_to_images.sh b/docs/tools/pdfs_to_images.sh new file mode 100755 index 00000000..73d65c61 --- /dev/null +++ b/docs/tools/pdfs_to_images.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# this converts PDF images to pngs for use in docs +# requires that you install imagemagick +# sudo yum -y install ImageMagick + +set -o xtrace + +BASEPATH=$1 + +function outputimage() { + # first arg is filename, second arg is output name + convert -density 600 $1 -quality 100 $2.png +} + +function get_path() { + # in the base directory given as first arg, return the path of the file + # with filename given in the second arg + FNAMEPATH=$(find $1 -type f -name "*$2") + echo $FNAMEPATH +} + +function producepng() { + # first arg is pdf filename + SOURCEPATH=$(get_path $1 $2) + outputimage $SOURCEPATH $2 +} + + +# $1 is starting path + +GOTPATH=$(get_path $1 "95th-memcached-request-latency.pdf") +echo $GOTPATH + + +producepng $BASEPATH "95th-memcached-request-latency.pdf"