Throw exported error in imageToPdf