Excerpts from Vincent Torri's message of lun oct 11 09:13:11 +0200 2010: > > Hey, > > I am trying to display the rectangles of the links of a pdf. Here is what > i do (basically, it's what the glib frontend does): > > /* I loop over the links */ > link = links.getLink(i); > link->getRect (&x1, &y1, &x2, &y2); > x1 -= ebp->page.page->getCropBox()->x1; > x2 -= ebp->page.page->getCropBox()->x1; > y1 -= ebp->page.page->getCropBox()->y1; > y2 -= ebp->page.page->getCropBox()->y1; > > link_item->rect.x = round(x1); > link_item->rect.y = round(y1); > link_item->rect.w = round(x2 - x1); > link_item->rect.h = round(y2 - y1); > > I display these rectangles on the pdf. I have attached the result > (rectangles are blue) and the pdf. > > Does someone see if what I did is wrong ?
You need to invert the y axis, in the PDF coordinate system the origin (0, 0) is at the lower-left corner, while in X is at the upper-left corner. So, you need something like: screen_rectangle.y = height - pdf_link_rectangle.y1; > thank you > > Vincent Torri Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
signature.asc
Description: PGP signature
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
