* Get a single page by index (0-based). * Returns null if index out of bounds.
(index: number)
| 1589 | * Returns null if index out of bounds. |
| 1590 | */ |
| 1591 | getPage(index: number): PDFPage | null { |
| 1592 | const ref = this.ctx.pages.getPage(index); |
| 1593 | |
| 1594 | if (!ref) { |
| 1595 | return null; |
| 1596 | } |
| 1597 | |
| 1598 | const dict = this.ctx.resolve(ref); |
| 1599 | |
| 1600 | if (!(dict instanceof PdfDict)) { |
| 1601 | return null; |
| 1602 | } |
| 1603 | |
| 1604 | return new PDFPage(ref, dict, index, this.ctx); |
| 1605 | } |
| 1606 | |
| 1607 | // ───────────────────────────────────────────────────────────────────────────── |
| 1608 | // Page manipulation |