properly check if pdf and svg modules are installed

The fact that imagick is installed does not imply that the pdf or svg modules are installed.
This patch makes sure that the pdf module is installed when using office and pdf previews and that the svg module is installed when using the svg and the unknown backend.

please review @DeepDiver1975 @PVince81 @karlitschek