# [texhax] Placing unknown images arbitrarily by lower left corner

Peter Davis pfd at pfdstudio.com
Wed Mar 30 19:35:26 CEST 2011

I'm working on a program to convert XML documents into LaTeX.  The XML has
several possibly ways of specifying how an image should be placed, and I'm
trying to find ways to produce LaTeX that will place the image correctly,
without having to actually open the image file in the XML->LaTeX converter.

For example, when the XML specifies size and position of the image,

<fo:block>
<fo:external-graphic src="url(xyz/image_1129.eps)"
content-height="2in"
content-width="3.5in"
myns:transformation="1 0 0 1 -8.71591 -17.5625"/>
</fo:block>

I can say generate LaTeX that looks like:

\begin{picture}(0,0)
\put(-8.715910,-113.978116){\includegraphics{xyz/image_1129.pdf}}
\end{picture

I was able to find the upper left corner of the image because I know where
the transformation puts the lower left corner, and I know the height of the
image.

However, sometimes the XML only specifies a transformation (and again, the
translation components refer to the *lower* left corner of the image):

<fo:block>
<fo:external-graphic
src="url(Documents/1/Resources/AP_logo_wirm_PMS_LLP.eps)"
content-height="33.1209%"
content-width="33.1209%"
myns:transformation="0.331209 0 0 0.331209 0 -11.7663"/>
</fo:block>

The content-height and content-width attributes just give me scale factors
from the transform matrix.

Is there a way to determine how to place the image in LaTeX given this?  I
don't care about the dimensions per se, but I might need to know the height
to determine the upper left corner, given the lower left corner.

Is there a way around this?  I think this describes the problem, but I can
try to be more explicit if this is not clear.

Thank you!

-pd

--
----
The Tech Curmudgeon
http://www.techcurmudgeon.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110330/df73d9a8/attachment.html>