Skip to content

Commit

Permalink
Put everything together
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideViolante committed Jun 4, 2023
1 parent 54217d5 commit b094042
Showing 1 changed file with 36 additions and 45 deletions.
81 changes: 36 additions & 45 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,38 @@
type Languages = 'ara' | 'bul' | 'chs' | 'cht' | 'hrv' | 'cze' | 'dan' | 'dut' |
'eng' | 'fin' | 'fre' | 'ger' | 'gre' | 'hun' | 'kor' | 'ita' | 'jpn' | 'pol' |
'por' | 'rus' | 'slv' | 'spa' | 'swe' | 'tur' |
// The following are only supported by OCREngine = '3'
'hin' | 'kan' | 'per' | 'tel' | 'tam' | 'tai' | 'vie';

type FileTypes = string | 'PDF' | 'GIF' | 'PNG' | 'JPG' | 'TIF' | 'BMP';

type ParsedResult = {
ErrorMessage: string;
ErrorDetails: string;
FileParseExitCode: 0 | 1 | -10 | -20 | -30 | -99;
HasOverlay: boolean,
Message: string;
ParsedText: string;
TextOverlay: any;
}

type OcrSpaceResponse = {
ErrorMessage: string;
ErrorDetails: string;
IsErroredOnProcessing: boolean;
OCRExitCode: number;
ParsedResults: ParsedResult[];
ProcessingTimeInMilliseconds: number
SearchablePDFURL: string;
}

type OcrSpaceOptions = {
apiKey?: string;
ocrUrl?: string;
language?: Languages;
isOverlayRequired?: boolean;
filetype?: FileTypes;
detectOrientation?: boolean;
isCreateSearchablePdf?: boolean;
isSearchablePdfHideTextLayer?: boolean;
scale?: boolean;
isTable?: boolean;
OCREngine?: '1' | '2' | '3';
}

declare module "ocr-space-api-wrapper" {
export type OcrSpaceLanguages = Languages;
export type OcrSpaceFileTypes = FileTypes;
export function ocrSpace(input: string, options?: OcrSpaceOptions): OcrSpaceResponse;
export function ocrSpace(
input: string,
options?: {
apiKey?: string;
ocrUrl?: string;
language?: 'ara' | 'bul' | 'chs' | 'cht' | 'hrv' | 'cze' | 'dan' | 'dut' |
'eng' | 'fin' | 'fre' | 'ger' | 'gre' | 'hun' | 'kor' | 'ita' | 'jpn' | 'pol' |
'por' | 'rus' | 'slv' | 'spa' | 'swe' | 'tur' |
// The following are only supported by OCREngine = '3'
'hin' | 'kan' | 'per' | 'tel' | 'tam' | 'tai' | 'vie';
isOverlayRequired?: boolean;
filetype?: string | 'PDF' | 'GIF' | 'PNG' | 'JPG' | 'TIF' | 'BMP';
detectOrientation?: boolean;
isCreateSearchablePdf?: boolean;
isSearchablePdfHideTextLayer?: boolean;
scale?: boolean;
isTable?: boolean;
OCREngine?: '1' | '2' | '3';
}
): {
ErrorMessage: string;
ErrorDetails: string;
IsErroredOnProcessing: boolean;
OCRExitCode: number;
ParsedResults: {
ErrorMessage: string;
ErrorDetails: string;
FileParseExitCode: 0 | 1 | -10 | -20 | -30 | -99;
HasOverlay: boolean,
Message: string;
ParsedText: string;
TextOverlay: any;
}[];
ProcessingTimeInMilliseconds: number
SearchablePDFURL: string;
};
}

0 comments on commit b094042

Please sign in to comment.