Alfresco / alfresco-transform-core

GNU Lesser General Public License v3.0
15 stars 24 forks source link

MNT-24205 Tiff to pdf page size regression #965

Closed SaraAspery closed 2 months ago

SaraAspery commented 2 months ago

In aio 2.5.7, the preview of a tiff image of 2552 pixels x 3300 pixels, at 300 ppi, would generate a pdf size of approximately 8.5 x 11 inches (LETTER size).

In aio 3.1.1 the same tiff image preview generates a much larger pdf, approximately 35 x 45 inches. This is because, in 2.5.7, the transform is executed by imageMagick which takes into account the image resolution of 300 ppi. In 3.1.1, the transform is executed by pdfbox which assumes a resolution of 72 ppi.

In 3.1.1, it is possible to specify a pdf format, such as "LETTER", "A4" or "DEFAULT". If no pdf fomat was entered, "DEFAULT" was assumed. Initially, if no pdf format was specified, the "DEFAULT" was used which was set to "A4". However, this prevented preservation of the original image size as seen in https://hyland.atlassian.net/browse/ATS-996, so "DEFAULT" was changed to use the original image size. For the tiff used in MNT-24205, at 300 ppi the image size is 8.5 x 11, but at 72 ppi is much larger.

This MNT attempts to recalculate the size of the tiff for pdfbox, using the number of pixels in the original image and the image resolution, if any. If no resolution is found, then the original image size cannot be calculated so the actual number of pixels are passed to pdfbox as before.