diff --git a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/BlockBox.java b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/BlockBox.java index 9ca07a3df..b5e33a1fb 100755 --- a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/BlockBox.java +++ b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/BlockBox.java @@ -782,9 +782,9 @@ private void sizeReplacedElement(LayoutContext c, ReplacedElement re) { if (rw > rh) { nw = cssWidth; - nh = intrinsicHeight; + nh = (int) (intrinsicHeight / rw); } else { - nw = intrinsicWidth; + nw = (int) (intrinsicWidth / rh); nh = cssHeight; } } else { diff --git a/openhtmltopdf-examples/src/main/resources/demos/images/landscape-sydney.jpg b/openhtmltopdf-examples/src/main/resources/demos/images/landscape-sydney.jpg new file mode 100644 index 000000000..10b76c04f Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/demos/images/landscape-sydney.jpg differ diff --git a/openhtmltopdf-examples/src/main/resources/demos/images/portrait-shuttle.jpg b/openhtmltopdf-examples/src/main/resources/demos/images/portrait-shuttle.jpg new file mode 100644 index 000000000..7199a6898 Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/demos/images/portrait-shuttle.jpg differ diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-img-in-table-cell-3.pdf b/openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-img-in-table-cell-3.pdf new file mode 100644 index 000000000..466035805 Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-img-in-table-cell-3.pdf differ diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-img-in-table-cell-3.html b/openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-img-in-table-cell-3.html new file mode 100644 index 000000000..3c2a8089e --- /dev/null +++ b/openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-img-in-table-cell-3.html @@ -0,0 +1,43 @@ + +
+ + + ++ + + | +
+ + + | +
+ + + | +