Skip to content

Commit 0445134

Browse files
author
Vitali Prudnikovich
committed
Fix cropping images height for the images with big width
DEVSIX-6985
1 parent e4892a8 commit 0445134

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

layout/src/main/java/com/itextpdf/layout/renderer/ImageRenderer.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,19 @@ public LayoutResult layout(LayoutContext layoutContext) {
196196
// indicates whether the placement is forced
197197
boolean isPlacingForced = false;
198198
if (width > layoutBox.getWidth() + EPS || height > layoutBox.getHeight() + EPS) {
199-
if (Boolean.TRUE.equals(getPropertyAsBoolean(Property.FORCED_PLACEMENT)) || (width > layoutBox.getWidth() && processOverflowX) || (height > layoutBox.getHeight() && processOverflowY)) {
199+
if (Boolean.TRUE.equals(getPropertyAsBoolean(Property.FORCED_PLACEMENT))) {
200200
isPlacingForced = true;
201201
} else {
202+
isPlacingForced = true;
203+
if (width > layoutBox.getWidth() + EPS) {
204+
isPlacingForced &= processOverflowX;
205+
}
206+
if (height > layoutBox.getHeight() + EPS) {
207+
isPlacingForced &= processOverflowY;
208+
}
209+
}
210+
211+
if (!isPlacingForced) {
202212
applyMargins(initialOccupiedAreaBBox, true);
203213
applyBorderBox(initialOccupiedAreaBBox, true);
204214
occupiedArea.getBBox().setHeight(initialOccupiedAreaBBox.getHeight());

0 commit comments

Comments
 (0)