import { Paper } from 'academia/types'; import { Source } from 'lexing'; import * as pdfdom from './pdfdom'; import * as models from './models'; export declare class PDF { source: Source; private _trailer; private _cross_references; private _cached_objects; private _cached_models; constructor(source: Source); readonly size: number; /** Since the trailers and cross references overlap so much, we might as well read them all at once. */ readTrailers(): void; /** read the trailer, which gives the location of the cross-reference table and of certain special objects within the body of the file (PDF32000_2008.pdf:7.5.1). For example: trailer << /Info 2 0 R /Root 1 0 R /Size 105 >> startxref 123456 %%EOF The trailer dictionary will generally have two important fields: "Root" and "Info", both of which are object references. Size is the number of objects in the document (or maybe just those in the cross references section that immediately follows the trailer?) */ readonly trailer: models.Trailer; /** Reads the xref section referenced from the trailer. Requires reading the trailer, if it hasn't already been read. */ readonly cross_references: pdfdom.CrossReference[]; /** Find the CrossReference matching the given IndirectReference, parsing the PDF's cross references if needed. Throws an Error if no match is found. */ findCrossReference(object_number: number, generation_number: number): pdfdom.CrossReference; getObject(object_number: number, generation_number: number): pdfdom.PDFObject; /** If getModel is called multiple times with the same object:generation number pair, the ctor should be the same, or at least, if the ctor is different, it should have a different name. */ getModel(object_number: number, generation_number: number, ctor: { new (pdf: PDF, object: pdfdom.PDFObject): T; }): T; /** Resolves a object reference to the original object from the PDF, parsing the PDF's cross references if needed. Throws an Error (from findCrossReference) if there is no CrossReference matching the requested IndirectReference. Also throws an Error if the matched CrossReference points to an IndirectObject that doesn't match the originally requested IndirectReference. */ private _readObject; /** This resolves the Root Catalog's Pages tree into an Array of all its leaves. */ readonly pages: models.Page[]; /** Render all of the PDF's pages into a single textual data structure, where each section is represented by a title string and a list of paragraphs (each paragraph is represented by a single string, without newlines). */ renderPaper(skipMissingCharacters?: boolean): Paper; /** Resolves a potential IndirectReference to the target object. 1. If input is an IndirectReference, uses getObject to resolve it to the actual object. 2. Otherwise, returns the input object. This is useful in the PDFObjectParser stream hack, but shouldn't be used elsewhere. */ _resolveObject(object: pdfdom.PDFObject): pdfdom.PDFObject; }