/** * @param IdmlElement $element * @param IdmlPage $page * @return array - top and left position offsets for the element */ protected function getElementPosition(IdmlElement $element, $page) { $idssCoordinates = IdmlBoundary::transform($element->boundary, $element->transformation); $pageIDSS = $page->idssCoordinates; $pageAdjustedBoundary = $idssCoordinates->applyOffset($pageIDSS->left, $pageIDSS->top); $pageAdjustedBoundary->roundToIntegers(); $weight = $element->getComputedBorders(); $top = $pageAdjustedBoundary->top - $weight; $left = $pageAdjustedBoundary->left - $weight; $element->setPosition(array('left' => $left, 'top' => $top)); return $this->adjustOffsetsToRefPoint($element); }