Method: RBPDF#setPageBoxes

Defined in:
lib/rbpdf.rb

#setPageBoxes(page, type, llx, lly, urx, ury, points = false) ⇒ Object Also known as: set_page_boxes

Set page boundaries.

@param int :page

page number

@param string :type

valid values are:

  • ‘MediaBox’ : the boundaries of the physical medium on which the page shall be displayed or printed

  • ‘CropBox’ : the visible region of default user space

  • ‘BleedBox’ : the region to which the contents of the page shall be clipped when output in a production environment

  • ‘TrimBox’ : the intended dimensions of the finished page after trimming

  • ‘ArtBox’ : the page’s meaningful content (including potential white space).

@param float :llx

lower-left x coordinate in user units

@param float :lly

lower-left y coordinate in user units

@param float :urx

upper-right x coordinate in user units

@param float :ury

upper-right y coordinate in user units

@param boolean :points

if true uses user units as unit of measure, if false uses PDF points

@access public
@since 5.0.010 (2010-05-17)


856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
# File 'lib/rbpdf.rb', line 856

def setPageBoxes(page, type, llx, lly, urx, ury, points=false)
  pageboxes = ['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']
  unless pageboxes.include?(type)
    return
  end
  if @pagedim[page].nil?
    # initialize array
    @pagedim[page] = {}
  end

  points ? k = 1 : k = @k
  @pagedim[page][type] = {}
  @pagedim[page][type]['llx'] = llx * k
  @pagedim[page][type]['lly'] = lly * k
  @pagedim[page][type]['urx'] = urx * k
  @pagedim[page][type]['ury'] = ury * k
end