fix error message when generating PDF with images