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

Method do_Do

pattern/web/pdf/pdfinterp.py:713–742  ·  view source on GitHub ↗
(self, xobjid)

Source from the content-addressed store, hash-verified

711
712 # invoke an XObject
713 def do_Do(self, xobjid):
714 xobjid = literal_name(xobjid)
715 try:
716 xobj = stream_value(self.xobjmap[xobjid])
717 except KeyError:
718 if STRICT:
719 raise PDFInterpreterError('Undefined xobject id: %r' % xobjid)
720 return
721 if 1 <= self.debug:
722 print >>sys.stderr, 'Processing xobj: %r' % xobj
723 subtype = xobj.get('Subtype')
724 if subtype is LITERAL_FORM and 'BBox' in xobj:
725 interpreter = self.dup()
726 bbox = list_value(xobj['BBox'])
727 matrix = list_value(xobj.get('Matrix', MATRIX_IDENTITY))
728 # According to PDF reference 1.7 section 4.9.1, XObjects in
729 # earlier PDFs (prior to v1.2) use the page's Resources entry
730 # instead of having their own Resources entry.
731 resources = dict_value(xobj.get('Resources')) or self.resources.copy()
732 self.device.begin_figure(xobjid, bbox, matrix)
733 interpreter.render_contents(resources, [xobj], ctm=mult_matrix(matrix, self.ctm))
734 self.device.end_figure(xobjid)
735 elif subtype is LITERAL_IMAGE and 'Width' in xobj and 'Height' in xobj:
736 self.device.begin_figure(xobjid, (0,0,1,1), MATRIX_IDENTITY)
737 self.device.render_image(xobjid, xobj)
738 self.device.end_figure(xobjid)
739 else:
740 # unsupported xobject type.
741 pass
742 return
743
744 def process_page(self, page):
745 if 1 <= self.debug:

Callers

nothing calls this directly

Calls 13

dupMethod · 0.95
literal_nameFunction · 0.90
stream_valueFunction · 0.90
list_valueFunction · 0.90
dict_valueFunction · 0.90
mult_matrixFunction · 0.90
PDFInterpreterErrorClass · 0.85
render_contentsMethod · 0.80
getMethod · 0.45
copyMethod · 0.45
begin_figureMethod · 0.45
end_figureMethod · 0.45

Tested by

no test coverage detected