Added more flexibility to html2pdf and mergePdf

Added the settings parameter to inject settings that needed to be globally defined up to now.
Improved the recursive mkdir method

Added extra logic for the case that exceptions get caught.