Update the page's /Contents object with Shape data. The argument controls whether data appear in foreground (default) or background.
(self, overlay: bool = True)
| 15795 | return |
| 15796 | |
| 15797 | def commit(self, overlay: bool = True) -> None: |
| 15798 | """Update the page's /Contents object with Shape data. |
| 15799 | |
| 15800 | The argument controls whether data appear in foreground (default) |
| 15801 | or background. |
| 15802 | """ |
| 15803 | CheckParent(self.page) # doc may have died meanwhile |
| 15804 | self.totalcont += self.text_cont |
| 15805 | self.totalcont = self.totalcont.encode() |
| 15806 | |
| 15807 | if self.totalcont: |
| 15808 | if overlay: |
| 15809 | self.page.wrap_contents() # ensure a balanced graphics state |
| 15810 | # make /Contents object with dummy stream |
| 15811 | xref = TOOLS._insert_contents(self.page, b" ", overlay) |
| 15812 | # update it with potential compression |
| 15813 | self.doc.update_stream(xref, self.totalcont) |
| 15814 | |
| 15815 | self.last_point = None # clean up ... |
| 15816 | self.rect = None # |
| 15817 | self.draw_cont = "" # for potential ... |
| 15818 | self.text_cont = "" # ... |
| 15819 | self.totalcont = "" # re-use |
| 15820 | |
| 15821 | |
| 15822 | class Story: |