Hello,
I've started using Prince XML to convert XHTML files and I have some comments. The first one is how to scale up (or down) an image to fit the page. Consider the following document, which includes the same image (266×400) 4 times:
It looks like the "height" or "max-height" property of the <img> elements is ignored, the first 3 images are just scaled to maximum width, even if that results in an image higher than the page.
The 4th case uses an <svg> wrapping around the image that should achieve what I want: scale the image up or down to fit the screen. However, it seems Prince is interpreting the percent height in the <svg> as relative to the page width, not height.
Are these known problems of Prince or am I doing something wrong?
Again, Michael day said in an email that "percentage values are generally interpreted relative to the width of the containing element, even if they are specified on a height property". Is this per-CSS-spec or just the way prince works? Even then, though, why are the max-width and width properties just ignored in the first 3 cases?
I've started using Prince XML to convert XHTML files and I have some comments. The first one is how to scale up (or down) an image to fit the page. Consider the following document, which includes the same image (266×400) 4 times:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
@page {
size: 9cm 12cm;
margin: 1mm;
}
body {
prince-image-resolution: 50dpi;
}
img.fit {
max-height: 100%;
max-width: 100%;
}
img.wide {
width: 100%;
}
img.high {
height: 100%;
}
</style>
</head>
<body>
<img class="fit" src="test.jpg"/>
<img class="wide" src="test.jpg"/>
<img class="high" src="test.jpg"/>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 266 400" preserveAspectRatio="xMidYMid meet">
<image width="266" height="400" xlink:href="test.jpg" />
</svg>
</body>
</html>
It looks like the "height" or "max-height" property of the <img> elements is ignored, the first 3 images are just scaled to maximum width, even if that results in an image higher than the page.
The 4th case uses an <svg> wrapping around the image that should achieve what I want: scale the image up or down to fit the screen. However, it seems Prince is interpreting the percent height in the <svg> as relative to the page width, not height.
Are these known problems of Prince or am I doing something wrong?
Again, Michael day said in an email that "percentage values are generally interpreted relative to the width of the containing element, even if they are specified on a height property". Is this per-CSS-spec or just the way prince works? Even then, though, why are the max-width and width properties just ignored in the first 3 cases?