MCPcopy Index your code
hub / github.com/clips/pattern / __init__

Method __init__

pattern/web/pdf/pdfparser.py:246–273  ·  view source on GitHub ↗

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

(self, doc, pageid, attrs)

Source from the content-addressed store, hash-verified

244 """
245
246 def __init__(self, doc, pageid, attrs):
247 """Initialize a page object.
248
249 doc: a PDFDocument object.
250 pageid: any Python object that can uniquely identify the page.
251 attrs: a dictionary of page attributes.
252 """
253 self.doc = doc
254 self.pageid = pageid
255 self.attrs = dict_value(attrs)
256 self.lastmod = resolve1(self.attrs.get('LastModified'))
257 self.resources = resolve1(self.attrs['Resources'])
258 self.mediabox = resolve1(self.attrs['MediaBox'])
259 if 'CropBox' in self.attrs:
260 self.cropbox = resolve1(self.attrs['CropBox'])
261 else:
262 self.cropbox = self.mediabox
263 self.rotate = (self.attrs.get('Rotate', 0)+360) % 360
264 self.annots = self.attrs.get('Annots')
265 self.beads = self.attrs.get('B')
266 if 'Contents' in self.attrs:
267 contents = resolve1(self.attrs['Contents'])
268 else:
269 contents = []
270 if not isinstance(contents, list):
271 contents = [ contents ]
272 self.contents = contents
273 return
274
275 def __repr__(self):
276 return '<PDFPage: Resources=%r, MediaBox=%r>' % (self.resources, self.mediabox)

Callers

nothing calls this directly

Calls 3

dict_valueFunction · 0.90
resolve1Function · 0.90
getMethod · 0.45

Tested by

no test coverage detected