miepmuts
10-07-2008, 02:07 AM
Hi,
I am creating a pdf document from xml and xslt. The target document also contains some svg graphics.
The data from the xml is used to create the correct svg image.
I have my complete picture, but now I want to add another feature.
I want to use an image on the harddisk and place it inside my svg image.
That image has the correct sizes to fit into a rectangle I draw right
after placing the image.
That image is rotated 90 degrees, so I have to rotate it back. Because of
the rotation, I have to scale the image back to it's original size. This
all works fine, I have a rotated image at the right size. Now I want to
place the image into my rectangle. When I try to place the image at the
correct place (as I think it should be) it doesn't place the image at the
correct position (it is placed somewhat higher and more to the left as I
expect it to be).
Here's the piece of code for the image:
<!-- Draw the tiff image -->
<svg:g transform="translate({$svg_image_width_first},
{$svg_image_height_first})">
<svg:g transform="rotate({$tiff_rotation}, {$tiff_width_middle},
{$tiff_height_middle})">
<svg:g transform="scale({$scale})">
<svg:image xlink:href="{$xml_bitmap_path}"
width="{$svg_image_width}"
height="{$svg_image_height}">
<svg:title>Front Image</svg:title>
</svg:image>
</svg:g>
</svg:g>
</svg:g>
I think it has something to do with the changed coordinate systems due to
the rotation and scaling. I can place the image manually with some values (which make no real sense to me) to the right position, but I like to have a generic solution, because not all the documents I generate have the same measurements and sizes.
A more concrete example I use right now is:
translate(51, 114).scale(1,25).rotate(-90)
Is there a generic solution, which I can use to generate all documents correct?
Thanks in advance,
Miepmuts
I am creating a pdf document from xml and xslt. The target document also contains some svg graphics.
The data from the xml is used to create the correct svg image.
I have my complete picture, but now I want to add another feature.
I want to use an image on the harddisk and place it inside my svg image.
That image has the correct sizes to fit into a rectangle I draw right
after placing the image.
That image is rotated 90 degrees, so I have to rotate it back. Because of
the rotation, I have to scale the image back to it's original size. This
all works fine, I have a rotated image at the right size. Now I want to
place the image into my rectangle. When I try to place the image at the
correct place (as I think it should be) it doesn't place the image at the
correct position (it is placed somewhat higher and more to the left as I
expect it to be).
Here's the piece of code for the image:
<!-- Draw the tiff image -->
<svg:g transform="translate({$svg_image_width_first},
{$svg_image_height_first})">
<svg:g transform="rotate({$tiff_rotation}, {$tiff_width_middle},
{$tiff_height_middle})">
<svg:g transform="scale({$scale})">
<svg:image xlink:href="{$xml_bitmap_path}"
width="{$svg_image_width}"
height="{$svg_image_height}">
<svg:title>Front Image</svg:title>
</svg:image>
</svg:g>
</svg:g>
</svg:g>
I think it has something to do with the changed coordinate systems due to
the rotation and scaling. I can place the image manually with some values (which make no real sense to me) to the right position, but I like to have a generic solution, because not all the documents I generate have the same measurements and sizes.
A more concrete example I use right now is:
translate(51, 114).scale(1,25).rotate(-90)
Is there a generic solution, which I can use to generate all documents correct?
Thanks in advance,
Miepmuts