def showPDFpage(<EOL>page,<EOL>rect,<EOL>src,<EOL>pno=<NUM_LIT:0>,<EOL>overlay=True,<EOL>keep_proportion=True,<EOL>rotate=<NUM_LIT:0>,<EOL>reuse_xref=<NUM_LIT:0>,<EOL>clip = None,<EOL>):
def calc_matrix(sr, tr, keep=True, rotate=<NUM_LIT:0>):<EOL><INDENT>"""<STR_LIT>"""<EOL>smp = Point((sr.x1 + sr.x0) / <NUM_LIT>, (sr.y1 + sr.y0) / <NUM_LIT>)<EOL>tmp = Point((tr.x1 + tr.x0) / <NUM_LIT>, (tr.y1 + tr.y0) / <NUM_LIT>)<EOL>rot = Matrix(rotate)  <EOL>m = Matrix(<NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>, -smp.x, -smp.y) * rot<EOL>sr1 = sr * m  <EOL>fw = tr.width / sr1.width  <EOL>fh = tr.height / sr1.height  <EOL>if keep:<EOL><INDENT>fw = fh = min(fw, fh)  <EOL><DEDENT>m *= Matrix(fw, fh)  <EOL>m *= Matrix(<NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>, tmp.x, tmp.y)  <EOL>return m<EOL><DEDENT>CheckParent(page)<EOL>doc = page.parent<EOL>if not doc.isPDF or not src.isPDF:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>rect = page.rect & rect  <EOL>if rect.isEmpty or rect.isInfinite:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if reuse_xref > <NUM_LIT:0>:<EOL><INDENT>warnings.warn("<STR_LIT>", DeprecationWarning)<EOL><DEDENT>while pno < <NUM_LIT:0>:  <EOL><INDENT>pno += len(src)<EOL><DEDENT>src_page = src[pno]  <EOL>if len(src_page._getContents()) == <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>tar_rect = rect * ~page._getTransformation()  <EOL>src_rect = src_page.rect if not clip else src_page.rect & clip  <EOL>if src_rect.isEmpty or src_rect.isInfinite:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>src_rect = src_rect * ~src_page._getTransformation()  <EOL>matrix = calc_matrix(src_rect, tar_rect, keep=keep_proportion, rotate=rotate)<EOL>ilst = [i[<NUM_LIT:1>] for i in doc._getPageInfo(page.number, <NUM_LIT:3>)]<EOL>n = "<STR_LIT>"<EOL>i = <NUM_LIT:0><EOL>_imgname = n + "<STR_LIT:0>"<EOL>while _imgname in ilst:<EOL><INDENT>i += <NUM_LIT:1><EOL>_imgname = n + str(i)<EOL><DEDENT>isrc = src._graft_id          <EOL>if doc._graft_id == isrc:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if isrc in doc.Graftmaps:     <EOL><INDENT>gmap = doc.Graftmaps[isrc]<EOL><DEDENT>else:                         <EOL><INDENT>gmap = Graftmap(doc)<EOL>doc.Graftmaps[isrc] = gmap<EOL><DEDENT>pno_id = (isrc, pno)          <EOL>xref = doc.ShownPages.get(pno_id, <NUM_LIT:0>)<EOL>xref = page._showPDFpage(<EOL>src_page,<EOL>overlay=overlay,<EOL>matrix=matrix,<EOL>xref=xref,<EOL>clip=src_rect,<EOL>graftmap=gmap,<EOL>_imgname=_imgname,<EOL>)<EOL>doc.ShownPages[pno_id] = xref<EOL>return xref<EOL>
Show page number 'pno' of PDF 'src' in rectangle 'rect'.

    Args:
        rect: (rect-like) where to place the source image
        src: (document) source PDF
        pno: (int) source page number
        overlay: (bool) put in foreground
        keep_proportion: (bool) do not change width-height-ratio
        rotate: (int) degrees (multiple of 90)
        clip: (rect-like) part of source page rectangle
    Returns:
        xref of inserted object (for reuse)