class PrawnHtml::DocumentRenderer

def bounds(buffer, options, block_styles)

def bounds(buffer, options, block_styles)
  return unless block_styles[:position] == :absolute
  x = if block_styles.include?(:right)
        x1 = pdf.calc_buffer_width(buffer) + block_styles[:right]
        x1 < pdf.page_width ? (pdf.page_width - x1) : 0
      else
        block_styles[:left] || 0
      end
  y = if block_styles.include?(:bottom)
        pdf.calc_buffer_height(buffer, options) + block_styles[:bottom]
      else
        pdf.page_height - (block_styles[:top] || 0)
      end
  [[x, y], { width: pdf.page_width - x }]
end