UNPKG

@pixdif/pdf-parser

Version:
22 lines (21 loc) 630 B
import { Outline } from '@pixdif/parser'; import PdfPage from './PdfPage.js'; export default class PdfOutline extends Outline { document; offset; limit; constructor(document, props) { super(props.title, props); this.document = document; this.offset = props.offset; this.limit = props.limit; } async getPageNum() { return this.limit - this.offset; } async getPage(index) { const pageIndex = this.offset + index; const page = await this.document.getPage(pageIndex); return new PdfPage(this.document, `Page ${pageIndex}`, page); } }