title: Parsing PDF pages as javascript Images
body: <p>As per title, is there any way I can parse pages from an unprotected PDF file as javascript Image() objects?</p>
  
  <p>It would also be ok to convert them before running the javascript, but I would like this to be done automatically and without the assistance of any library which requires installation.</p>
  
  <p>Someone over the internet has posted this Bash script. Unfortunately, I don't know Bash but running it was very simple.</p>
  
  <pre><code>#!/bin/bash
  PDF='doc.pdf'
  NUMPAGES=`identify -format %n "$PDF"`
  
  for (( IDX=0; IDX&lt;$NUMPAGES; IDX++ ))
  do
    PAGE=$(($IDX+1))
    convert -resize 1200x900 "$PDF[$IDX]" `echo "$PDF" | sed "s/\.pdf$/-page$PAGE.jpg/"`
  done
  
  echo "Done"
  </code></pre>
  
  <p>But I got these errors:</p>
  
  <pre><code>line 3: identify: command not found
  line 5: ((: IDX&lt;: syntax error: operand expected (error token is "&lt;")
  </code></pre>
  
  <p>Pre-converting the PDF using a Bash script would be a good solution. Can someone fix the script above or either provide an alternative solution?</p>
  
  <p>Many thanks in advance!</p>