Re-layout a reflowable document.
(self, rect=None, width=0, height=0, fontsize=11)
| 5727 | return rc |
| 5728 | |
| 5729 | def layout(self, rect=None, width=0, height=0, fontsize=11): |
| 5730 | """Re-layout a reflowable document.""" |
| 5731 | if self.is_closed or self.is_encrypted: |
| 5732 | raise ValueError("document closed or encrypted") |
| 5733 | doc = self.this |
| 5734 | if not mupdf.fz_is_document_reflowable( doc): |
| 5735 | return |
| 5736 | w = width |
| 5737 | h = height |
| 5738 | r = JM_rect_from_py(rect) |
| 5739 | if not mupdf.fz_is_infinite_rect(r): |
| 5740 | w = r.x1 - r.x0 |
| 5741 | h = r.y1 - r.y0 |
| 5742 | if w <= 0.0 or h <= 0.0: |
| 5743 | raise ValueError( "bad page size") |
| 5744 | mupdf.fz_layout_document( doc, w, h, fontsize) |
| 5745 | |
| 5746 | self._reset_page_refs() |
| 5747 | self.init_doc() |
| 5748 | |
| 5749 | def load_page(self, page_id): |
| 5750 | """Load a page. |