As per title, is there any way I can parse pages from an unprotected PDF file as javascript Image() objects?
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.
Someone over the internet has posted this Bash script. Unfortunately, I don't know Bash but running it was very simple.
#!/bin/bash
PDF='doc.pdf'
NUMPAGES=`identify -format %n "$PDF"`
for (( IDX=0; IDX<$NUMPAGES; IDX++ ))
do
PAGE=$(($IDX+1))
convert -resize 1200x900 "$PDF[$IDX]" `echo "$PDF" | sed "s/\.pdf$/-page$PAGE.jpg/"`
done
echo "Done"
But I got these errors:
line 3: identify: command not found
line 5: ((: IDX<: syntax error: operand expected (error token is "<")
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?
Many thanks in advance!