You can use various common Unix tools to manipulate the data, though the effort may not be worth it if the original pdfs are all very different. I tried the following:
Convert the pdf to PostScript which is simpler to manipulate using pdf2ps (part of ghostscript):
pdf2ps Question-paper.pdf out.ps
Looking through this file you can see how the horizontal lines (on which to write the answer) are drawn with a string of underlines:
Use sed to convert the underlines to spaces:
sed <out.ps '/^(___________________________________________/s/_/ /g' >out2.ps
(I tried removing the line, but the PostScript code is a bit obscure and no longer worked, so this is easiest).
We now have pages we can convert to png images using ImageMagick:
convert -background white -alpha remove out2.ps -crop 450x500+40+40 -trim pic%02d.png
This generates files pic01.png and so on, one per page, cropping to just the rectangle of size 450x500 and offset xy +40+40, and then trimming the whitespace. This leaves just the question visible, or on the continuation page it leaves just the text: "question N continues". You can detect these unwanted images to remove by their small size, which you can get from
However, if your other pdfs don't use the same simple underlines technique to fill out the page, or if they offset left page and right page differently etc, you will have to manually tweak the commands each time.