Monday, April 13, 2015

Create a set of large PDFs

Next step after I created a test PDF file, was to create a set of PDF files of different sizes. The initial test file, which I created as was described in my previous post, I called large10MB.pdf, and I combined it multiple times to get a set of files of multiple sizes. I used pdftk server toolkit to combine multiple 10MB-large files together to get a file with appropriate size.

#!/bin/bash

for SIZE in 10 20 30 40 50 60 70 80 90 100 150 200 250 300; 
do
num=$(($SIZE/10))
LARGEDOC="large10MB.pdf"
arg=""
for (( c=1; c<=$num; c++ ))
do
  arg="$arg $LARGEDOC"
done
command="pdftk $arg testContent.pdf cat output largePDF.${SIZE}MB.pdf"
${command}
echo "<a href='largePDF.${SIZE}MB.pdf'>PDF size ${SIZE} MB.</a><br/>" 
done

No comments:

Post a Comment