## Top left image position

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
dkaip
Super wx Problem Solver
Posts: 251
Joined: Wed Jan 20, 2010 1:15 pm

### Top left image position

Hello.
Inserting an image in a page with Image(file) function, i dont know the top left corner of image in pdf page?
How i can find it?
Code bellow don't gives me top left.
Thank's
Jim

Code: Select all

``aFile.Line(aFile.GetRightMargin(),aFile.GetTopMargin(),aFile.GetLastImageBottomRightX(),aFile.GetLastImageBottomRightY());``

dkaip
Super wx Problem Solver
Posts: 251
Joined: Wed Jan 20, 2010 1:15 pm

### Re: Top left image position

As i Just see is code ok? from top left to bottom down?
It works, but is the right way?

Code: Select all

``````double x=aFile.GetX();
double y=aFile.GetY();
aFile.Line(x,y,aFile.GetLastImageBottomRightX(),aFile.GetLastImageBottomRightY());
``````

utelle
Moderator
Posts: 971
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

### Re: Top left image position

dkaip wrote:As i Just see is code ok? from top left to bottom down?
It works, but is the right way?

Code: Select all

``````double x=aFile.GetX();
double y=aFile.GetY();
aFile.Line(x,y,aFile.GetLastImageBottomRightX(),aFile.GetLastImageBottomRightY());
``````
When calling method Image to insert an image into the PDF document, you have to specify explicitly where to place the top left corner of the image via arguments x and y. If you want to draw a line from that position to the bottom right corner, you have to remember the coordinates of the top left corner, because the current position (which you get from GetX and GetY) could possibly change, except that no output action other than inserting the image takes place before you draw the line.

Regards,

Ulrich

dkaip
Super wx Problem Solver
Posts: 251
Joined: Wed Jan 20, 2010 1:15 pm

### Re: Top left image position

Thank's, as i see i must catch coordinates immediately after image inserting.
Jim