Refactor PDF to PNG conversion to a use a service object

Also generate PDF filename using SecureRandom and sanitize PDF filename
before using it as the output file basename.

References Coursemology/coursemology.org#277