/**
  * The getDimensionCSS function should return a CSS declaration for the element's width and height.
  */
 public function getDimensionCSS(IdmlElement $element)
 {
     $weight = $element->getComputedBorders();
     $twice_weight = $weight * 2;
     switch (get_class($element)) {
         case 'IdmlTextFrame':
             if ($element->isEmbedded()) {
                 return sprintf("width:%spx; height:%spx;", round($twice_weight + $element->boundary->getWidth()), round($twice_weight + $element->boundary->getHeight()));
             } else {
                 return '';
             }
         case 'IdmlRectangle':
             // If a rectangle's sole child is a video or audio, don't set the dimensions, since IDML does not account for controls.
             // Otherwise, fall through to the default behavior.
             if (count($element->childrenElements) == 1 && in_array(get_class($element->childrenElements[0]), array('IdmlMovie', 'IdmlSound'))) {
                 return '';
             }
         case 'IdmlGroup':
             return sprintf("width:%spx; height:%spx;", round($twice_weight + $element->boundary->getWidth()), round($twice_weight + $element->boundary->getHeight()));
         default:
             return '';
     }
 }
 /**
  * @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);
 }