mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-26 17:24:47 +00:00
ATS-995, MNT-23248: TIFF to PDF ImageMagick transform don't work
- type and edge case fix
This commit is contained in:
parent
2060660b21
commit
c0ecf94b7b
@ -136,9 +136,9 @@ public class ImageToPdfTransformer implements CustomTransformerFileAdaptor
|
||||
try (PDPageContentStream pdfPageContent = new PDPageContentStream(pdfDocument, pdfPage))
|
||||
{
|
||||
final PDRectangle pageSize = pdfPage.getMediaBox();
|
||||
final float withRatio = pageSize.getWidth() / image.getWidth();
|
||||
final float heightRatio = pageSize.getHeight() / image.getHeight();
|
||||
final float ratio = Stream.of(withRatio, heightRatio, 1f).min(Comparator.naturalOrder()).get();
|
||||
final float widthRatio = image.getWidth() > 0 ? pageSize.getWidth() / image.getWidth() : 0;
|
||||
final float heightRatio = image.getHeight() > 0 ? pageSize.getHeight() / image.getHeight() : 0;
|
||||
final float ratio = Stream.of(widthRatio, heightRatio, 1f).min(Comparator.naturalOrder()).get();
|
||||
// find image bottom
|
||||
final float y = pageSize.getHeight() - image.getHeight() * ratio;
|
||||
// drawing starts from bottom left corner
|
||||
|
Loading…
x
Reference in New Issue
Block a user