I think its something like this:

Rectangle position = new
Rectangle(document.left(),document.bottom(),document.right(),document.top());

float imgLeft = position.getLeft() + (position.getWidth() -
image.getScaledWidth())/2;
float imgBottom = position.getBottom() + (position.getHeight() -
image.getScaledHeight())/2;
image.setAbsolutePosition(imgLeft,imgBottom);

On 8/7/07, Lars Nagel (Trium) <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I want to position an image with setAbsolutePosition(...) such that it
> is displayed in the center of the page. As setAbsolutePosition(...) gets
> the coordinates of the lower left corner, I need the picture's width and
> height. But getWidth() and getHeight() return the width / height in
> pixels, and I have no idea how to translate them into points.
>
> Have you any idea?
>
> Thanks in advance,
> Lars
>
> --
> Lars Nagel
>
> Trium Analysis Online GmbH
> Hohenlindenerstr. 1
> 81677 München
>
> Fon : +49 89 2060269 21
> Fax : +49 89 2060269 11
> Internet: www.trium.de
>
> Amtsgericht Muenchen, HRB 134012
> Managing Directors:
> Dr. Martin Daumer, Michael Scholz
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to