Update the page's /Contents object with Shape data. The argument controls whether data appear in foreground (default) or background.

def commit(self, overlay=True):
        """Update the page's /Contents object with Shape data. The argument controls whether data appear in foreground (default) or background.
        """
        CheckParent(self.page)              # doc may have died meanwhile
        self.totalcont += self.text_cont

        if not fitz_py2:                    # need bytes if Python > 2
            self.totalcont = bytes(self.totalcont, "utf-8")

        # make /Contents object with dummy stream
        xref = TOOLS._insert_contents(self.page, b" ", overlay)
        # update it with potential compression
        self.doc._updateStream(xref, self.totalcont)

        self.lastPoint  = None         # clean up ...
        self.rect       = None         #
        self.draw_cont  = ""           # for possible ...
        self.text_cont  = ""           # ...
        self.totalcont  = ""           # re-use
        return