Luke Shannon wrote:
If I specify one of the dimensions of an external image should this not
ensure that the resolution used in the PDF will be the same as the orginal?
I am trying to use a hi rez image as my header, however it looks like it is
being written as 72dpi in the document, even though I specify the width.
Any resolution metadata in a bitmapped image is ignored by FOP.
The image code first gets h&w in pixel, the computes h&w in
1/1000 pt by assuming 72dpi. If this fits in the area, the image
is shown exactly at this resolution. If the image would overflow
the area, it is shrunk to fit while keeping the aspect ratio.
If the area measurements are determined by an explicit height
and/or width specification, and the image was smaller than the
area, it is stretched to fit. If only one of height or width
has been specified and the other dimension is determined by the
parent area, the image is stretched to fit the area in the
specified dimension while keeping the aspect ratio, which may
overflow in the other dimension and cause all kind of havoc.
If both height and width are specified, the image is scaled to
fit without caring for the aspect ratio.
If you specify the height and/or width and you know the image
size in pixels, you can calculate the dimension (at least for
non-bitmapped output formats). For example, a 1000x1000 image
used in
<fo:external-graphics width="2in" height="4in" src="foo.img"/>
will be stretched and rendered at 500dpi in x direction and
250dpi in y direction.
Note there are problems with images in static content. As a rule
of thumb you will not hit them for the common case of images in
the region-before and -after if you keep the extent of the
body region larger than the extent of the other regions.
Note that these rules apply to bitmap images only. The rules for
SVG, either in fo:external-graphic and fo:instream-foreign-object,
are different and quite a bit more obscure. As a rule of thumb,
always specify *both* height and width on both the FO and the
SVG document element, be sure to use identical height and width
for the two specifications, and don't use pixels.
For example
<fo:instream-foreign-object height="5cm" width="8cm">
<svg:svg height="5cm" width="8cm" ...
should almost work as expected, while omitting or using different
measurements on the elements is likely to produve unexpected
results, in particular the SVG may be clipped (bitmap images
are *never* clipped).
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]