Make a new PDF page.
(self, pno=-1, width=595, height=842)
| 4032 | self._reset_page_refs() |
| 4033 | |
| 4034 | def _newPage(self, pno=-1, width=595, height=842): |
| 4035 | """Make a new PDF page.""" |
| 4036 | if self.is_closed or self.is_encrypted: |
| 4037 | raise ValueError("document closed or encrypted") |
| 4038 | if g_use_extra: |
| 4039 | extra._newPage( self.this, pno, width, height) |
| 4040 | else: |
| 4041 | pdf = _as_pdf_document(self) |
| 4042 | mediabox = mupdf.FzRect(mupdf.FzRect.Fixed_UNIT) |
| 4043 | mediabox.x1 = width |
| 4044 | mediabox.y1 = height |
| 4045 | contents = mupdf.FzBuffer() |
| 4046 | if pno < -1: |
| 4047 | raise ValueError( MSG_BAD_PAGENO) |
| 4048 | # create /Resources and /Contents objects |
| 4049 | #resources = pdf.add_object(pdf.new_dict(1)) |
| 4050 | resources = mupdf.pdf_add_new_dict(pdf, 1) |
| 4051 | page_obj = mupdf.pdf_add_page( pdf, mediabox, 0, resources, contents) |
| 4052 | mupdf.pdf_insert_page( pdf, pno, page_obj) |
| 4053 | # fixme: pdf->dirty = 1; |
| 4054 | |
| 4055 | self._reset_page_refs() |
| 4056 | return self[pno] |
| 4057 | |
| 4058 | def _remove_links_to(self, numbers): |
| 4059 | pdf = _as_pdf_document(self) |
no test coverage detected