Closed MarcinZiabek closed 3 years ago
This functionality is ready and planned to be released with QuestPDF 2021.04
How can I achieve image fit to contain. For example, I set container height to 100 and if image width bigger than height it scale height to fit and crop width or I set container width to 100 and image's height bigger than its width. The Image fit the width and crop height.
Is your feature request related to a problem? Please describe. I want to decide which scaling rule is used in order to display the Image element. Depending on the scenario, the image element should preserve its aspect ratio and fit available width/height/space. There are also cases when the image should be scaled unproportionally.
Currently, the Image element changes its size according to provided rules: 1) It tries to fit the available space. 2) It always prevents its aspect ratio.
Describe the solution you'd like Provide a flag to decide how the image is going to be scaled: 1) To fit the available width. 2) To fit the available height. 3) To fit the available space (both width and height = safest). 4) To cover provided area without preserving its aspect ratio (also safe but usually not desired).
Additional context Important: this change needs to be properly documented. There are cases when a selected option may lead to infinite layouts. For example: