Fix #872 "Image not properly resized in PDF"