Update the page's /Contents object with Shape data. The argument controls whether data appear in foreground (default) or background.
(self, overlay: bool = True)
| 4027 | return |
| 4028 | |
| 4029 | def commit(self, overlay: bool = True) -> None: |
| 4030 | """Update the page's /Contents object with Shape data. The argument controls whether data appear in foreground (default) or background.""" |
| 4031 | CheckParent(self.page) # doc may have died meanwhile |
| 4032 | self.totalcont += self.text_cont |
| 4033 | |
| 4034 | self.totalcont = self.totalcont.encode() |
| 4035 | |
| 4036 | if self.totalcont != b"": |
| 4037 | # make /Contents object with dummy stream |
| 4038 | xref = TOOLS._insert_contents(self.page, b" ", overlay) |
| 4039 | # update it with potential compression |
| 4040 | self.doc.update_stream(xref, self.totalcont) |
| 4041 | |
| 4042 | self.lastPoint = None # clean up ... |
| 4043 | self.rect = None # |
| 4044 | self.draw_cont = "" # for potential ... |
| 4045 | self.text_cont = "" # ... |
| 4046 | self.totalcont = "" # re-use |
| 4047 | return |
| 4048 | |
| 4049 | |
| 4050 | def apply_redactions(page: Page, images: int = 2) -> bool: |
no test coverage detected