Throw exported error in imageToPdf

Just a small fix.