UNPKG

pdfdataextract

Version:

Extract data from a pdf with pure javascript

284 lines (283 loc) 4.8 kB
import { PDFPageProxy } from 'pdfjs-dist/types/src/display/api'; export declare enum ImageKind { /** * */ GRAYSCALE_1BPP = 1, /** * */ RGB_24BPP = 2, /** * */ RGBA_32BPP = 3 } /** * */ export declare class ContentInfo { } /** * */ export declare class PathInfo extends ContentInfo { /** * */ path: ([number, number, number, number] | [number, number, number, number, number, number])[]; /** * */ open: boolean; /** * */ stroke: { /** * */ color: number; /** * */ width: number; } | null; /** * */ fill: { /** * */ color: number; } | null; /** * @param path * @param open * @param stroke * @param fill */ constructor(path: ([number, number, number, number] | [number, number, number, number, number, number])[], open: boolean, stroke: { /** * */ color: number; /** * */ width: number; } | null, fill: { /** * */ color: number; /** * */ eo: boolean; } | null); } /** * */ export declare class TextContent extends ContentInfo { /** * */ text: string; /** * @param text */ constructor(text: string); } /** * */ export declare class ImageContent extends ContentInfo { /** * */ width: number; /** * */ height: number; /** * */ kind: ImageKind; /** * */ data: Uint8Array; /** * @param width * @param height * @param kind * @param data */ constructor(width: number, height: number, kind: ImageKind | undefined, data: Uint8Array); } export declare enum LineCap { /** * */ BUTT = 0, /** * */ ROUND = 1, /** * */ SQUARE = 2 } export declare enum LineJoin { /** * */ MITER = 0, /** * */ ROUND = 1, /** * */ BEVEL = 2 } export declare enum ClipType { /** * */ NORMAL = 0, /** * */ EO = 1 } export declare enum TextRenderingMode { /** * */ FILL = 0, /** * */ STROKE = 1, /** * */ FILL_STROKE = 2, /** * */ INVISIBLE = 3, /** * */ FILL_ADD_TO_PATH = 4, /** * */ STROKE_ADD_TO_PATH = 5, /** * */ FILL_STROKE_ADD_TO_PATH = 6, /** * */ ADD_TO_PATH = 7, /** * */ FILL_STROKE_MASK = 3, /** * */ ADD_TO_PATH_FLAG = 4 } /** * */ export declare class ContentInfoExtractor { private contentInfo; private state; private clipType; private stateStack; private page; private commonObjs; private objs; /** * @param page */ constructor(page: PDFPageProxy); /** * */ getContentInfo(): Promise<ContentInfo[]>; private setLineWidth; private setLineCap; private setLineJoin; private setMiterLimit; private setDash; private setGState; private save; private restore; private transform; private closePath; private stroke; private closeStroke; private fill; private eoFill; private fillStroke; private eoFillStroke; private closeFillStroke; private closeEOFillStroke; private endPath; private clip; private eoClip; private beginText; private endText; private setCharSpacing; private setWordSpacing; private setHScale; private setLeading; private setFont; private setTextRenderingMode; private setTextRise; private moveText; private setLeadingMoveText; private setTextMatrix; private nextLine; private showText; private setCharWidthAndBounds; private setStrokeAlpha; private setStrokeRGBColor; private setFillAlpha; private setFillRGBColor; private setBlendMode; private setSMask; private shadingFill; private beginMarkedContent; private beginMarkedContentProps; private endMarkedContent; private paintFormXObjectBegin; private paintFormXObjectEnd; private beginGroup; private endGroup; private beginAnnotation; private endAnnotation; private paintImageMaskXObject; private paintImageMaskXObjectGroup; private paintImageXObject; private paintInlineImageXObject; private paintSolidColorImageMask; private constructPath; private setStrokeTransparent; private setFillTransparent; private static loadDependencies; private fromOperatorList; }