MCPcopy Create free account
hub / github.com/LibPDF-js/core / getPages

Method getPages

src/api/pdf.ts:1562–1578  ·  view source on GitHub ↗

* Get all pages in document order.

()

Source from the content-addressed store, hash-verified

1560 * Get all pages in document order.
1561 */
1562 getPages(): PDFPage[] {
1563 const refs = this.ctx.pages.getPages();
1564 const pages: PDFPage[] = [];
1565
1566 for (let i = 0; i < refs.length; i++) {
1567 const ref = refs[i];
1568 const dict = this.ctx.resolve(ref);
1569
1570 if (!(dict instanceof PdfDict)) {
1571 throw new Error(`Page ${i} is not a dictionary`);
1572 }
1573
1574 pages.push(new PDFPage(ref, dict, i, this.ctx));
1575 }
1576
1577 return pages;
1578 }
1579
1580 /**
1581 * Get page count.

Callers 2

extractTextMethod · 0.95
findTextMethod · 0.95

Calls 3

pushMethod · 0.80
getPagesMethod · 0.65
resolveMethod · 0.45

Tested by

no test coverage detected