-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve conflicts in package.json for pdfparser.d.ts branch
- Loading branch information
Showing
3 changed files
with
150 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import {EventEmitter} from "events"; | ||
|
||
declare class Pdfparser extends EventEmitter{ | ||
constructor(); | ||
parseBuffer(buffer: Buffer): void; | ||
loadPDF(pdfFilePath: string, verbosity?: number):Promise<void> | ||
createParserStream():ParserStream | ||
on<K extends keyof EventMap>(eventName: K, listener: EventMap[K]): this | ||
} | ||
|
||
type EventMap = { | ||
"pdfParser_dataError": (errMsg: string) => void; | ||
"pdfParser_dataReady": (pdfData: Output) => void; | ||
"readable": (meta: Output["Meta"]) => void; | ||
"data": (data: Output["Pages"][number]|null) => void; | ||
} | ||
|
||
declare class ParserStream{ | ||
//TODO | ||
} | ||
|
||
|
||
export interface Output{ | ||
Transcoder: string, | ||
Meta: Record<string, any> | ||
Pages: Page[] | ||
} | ||
|
||
declare interface Page{ | ||
Width: number, | ||
Height: number, | ||
HLines: Line[], | ||
VLines: Line[], | ||
Fills: Fill[], | ||
Texts: Text[], | ||
Fields: Field[], | ||
Boxsets: Boxset[] | ||
} | ||
|
||
declare interface Fill { | ||
x: number, | ||
y: number, | ||
w: number, | ||
h: number, | ||
oc?: string, | ||
clr?: number | ||
} | ||
|
||
declare interface Line { | ||
x: number, | ||
y: number, | ||
w: number, | ||
oc?: string, | ||
clr?:number | ||
} | ||
|
||
declare interface Text { | ||
x: number, | ||
y: number, | ||
w: number, | ||
sw: number, | ||
A: 'left' | 'center' | 'right', | ||
R: TextRun[] | ||
oc?:string; | ||
clr?: number; | ||
} | ||
|
||
declare interface TextRun { | ||
T: string, | ||
S: number, | ||
TS: [number, number, 0|1, 0|1] | ||
RA?: number | ||
} | ||
|
||
declare interface Boxset { | ||
boxes: Box[], | ||
id : { | ||
Id: string, | ||
EN?: number | ||
} | ||
} | ||
|
||
declare interface Field { | ||
id: { | ||
Id: string, | ||
EN?: number | ||
}, | ||
style: number, | ||
TI: number, | ||
AM: number, | ||
TU: string, | ||
x: number, | ||
y: number, | ||
w: number, | ||
h: number, | ||
T: { | ||
Name: 'alpha' | 'link', | ||
TypeInfo: {} | ||
} | ||
} | ||
|
||
declare interface Box { | ||
x: number, | ||
y: number, | ||
w: number, | ||
h: number, | ||
oc?: string, | ||
clr?: number | ||
} | ||
|
||
declare interface Box { | ||
id : { | ||
Id : string, | ||
EN? : number | ||
} | ||
T: { | ||
Name : string, | ||
TypeInfo? : {} | ||
} | ||
x: number, | ||
y: number, | ||
w: number, | ||
h: number, | ||
TI: number; | ||
AM: number; | ||
checked?: boolean; | ||
style: number | ||
} | ||
|
||
export default Pdfparser |