@thegrizzlylabs/web-geniusscan-sdk
Version:
Add a custom document scanner to your web apps by using and customizing our proven imaging technology. The Document Scanner SDK is the same software that we use at the core of Genius Scan: it's tried and trusted every day by millions of people on iOS and
62 lines (49 loc) • 1.56 kB
TypeScript
import { FILTERS } from "./lib/scan-processor";
import { ACCEPTED_LANGUAGES } from "./lib/i18n";
import { ACTIONS, SOURCES } from "./configuration";
type PostProcessingAction = (typeof ACTIONS)[number];
type MultiPageFormat = "pdf" | "none";
type PDFPageSize = "fit" | "a4" | "letter";
type Filter = (typeof FILTERS)[number];
type Language = (typeof ACCEPTED_LANGUAGES)[number];
type Source = (typeof SOURCES)[number];
interface Configuration {
// Internal options
showFps?: boolean;
// Publicly documented options
source?: Source;
sourceImage?: Blob;
multiPage?: boolean;
multiPageFormat?: MultiPageFormat;
defaultFilter?: Filter;
availableFilters?: Filter[];
jpegQuality?: number;
postProcessingActions?: PostProcessingAction[];
outputOriginalImage?: boolean;
foregroundColor?: string;
backgroundColor?: string;
highlightColor?: string;
language?: Language;
// PDF generation options
pdfTitle?: string;
pdfPageSize?: PDFPageSize;
}
type Image = {
data: Blob;
type: "image/jpeg";
};
type Scan = {
enhancedImage: Image;
originalImage?: Image;
};
type ScanResult = {
scans: Scan[];
multiPageDocument?: {
data: Blob;
type: "application/pdf";
};
};
export function setLicenseKey(licenseKey: string): Promise<void>;
export function scanDocument(configuration: Configuration): Promise<Image[]>;
export function scanWithConfiguration(configuration: Configuration): Promise<ScanResult>;
export function generatePDFFromImages(jpegs: Blob[], pdfPageSize?: PDFPageSize, title?: string): Promise<Blob>;