Fix logo image size calculation

As reported in #27, in some cases the logo will not be displayed on the PDF-printout. This is caused by a miscalculation of the new image dimensions.

Instead of using the image ratio, I calculated the scale factor for the dimension that needs to be reduced most in order to match the max width and height.

Apart from that, I set the maximum image width to the page width. I understand why the height needs to be reduced but I see no reason to prohibit a full size banner on top of the page.