Left, right, top and bottom distances of image in pdf page.

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

Left, right, top and bottom distances of image in pdf page.

Postby dkaip » Wed May 23, 2018 8:11 am

I have a wxPdfDocument file and inserting an image how i know right and bottom image distances in page?
The pdf page is 210X297 mm, and import an image with file.InsertImage(image).
Left is with GetX(), top with GetY() functions, but the others?



Code: Select all

bool InsertImage(wxString image)
{
    AddPage(-1,210,297);
    wxImage pageimage(image);
    double x=210
    double y=297
    double dx=pageimage.GetWidth();
    double dy=pageimage.GetHeight();
    double x1=10;
    double y1=30;

    if(x/dx<=y/dy)
        Image(image,x1,y1,x-2*x1,0);
    else
        Image(image,x1,y1,0,y-2*y1+x1);

    return true;
}


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

Re: Left, right, top and bottom distances of image in pdf page.

Postby utelle » Thu Jun 07, 2018 6:25 pm

dkaip wrote:I have a wxPdfDocument file and inserting an image how i know right and bottom image distances in page?
The pdf page is 210X297 mm, and import an image with file.InsertImage(image).
Left is with GetX(), top with GetY() functions, but the others?

Use methods GetLastImageBottomRightX and GetLastImageBottomRightY to get the position of the bottom right corner of the image after the call to method Image.

Regards,

Ulrich


Return to “wxCode”

Who is online

Users browsing this forum: No registered users and 0 guests