'Initialize a page object.
doc: a PDFDocument object.
pageid: any Python object that can uniquely identify the page.
attrs: a dictionary of page attributes.'

def __init__(self, doc, pageid, attrs):

    self.doc = doc
    self.pageid = pageid
    self.attrs = dict_value(attrs)
    self.lastmod = resolve1(self.attrs.get('LastModified'))
    self.resources = resolve1(self.attrs['Resources'])
    self.mediabox = resolve1(self.attrs['MediaBox'])
    if ('CropBox' in self.attrs):
        self.cropbox = resolve1(self.attrs['CropBox'])
    else:
        self.cropbox = self.mediabox
    self.rotate = ((self.attrs.get('Rotate', 0) + 360) % 360)
    self.annots = self.attrs.get('Annots')
    self.beads = self.attrs.get('B')
    if ('Contents' in self.attrs):
        contents = resolve1(self.attrs['Contents'])
    else:
        contents = []
    if (not isinstance(contents, list)):
        contents = [contents]
    self.contents = contents
    return
