UNPKG

@nutrient-sdk/dws-client-typescript

Version:

Node.js TypeScript client library for Nutrient Document Web Services (DWS) API

204 lines 11.2 kB
import type { components } from './generated/api-types'; import type { FileInput } from './types'; /** * Internal action type that holds FileInput for deferred registration */ export interface ActionWithFileInput<Action extends components['schemas']['BuildAction'] = components['schemas']['BuildAction']> { __needsFileRegistration: true; fileInput: FileInput; createAction: (fileHandle: components['schemas']['FileHandle']) => Action; } /** * Factory functions for creating common build actions */ export declare const BuildActions: { /** * Create an OCR action * @param language - Language(s) for OCR */ ocr(language: components["schemas"]["OcrLanguage"] | components["schemas"]["OcrLanguage"][]): components["schemas"]["OcrAction"]; /** * Create a rotation action * @param rotateBy - Rotation angle (90, 180, or 270) */ rotate(rotateBy: 90 | 180 | 270): components["schemas"]["RotateAction"]; /** * Create a text watermark action * @param text - Watermark text * @param options - Watermark options * @param options.width - Width dimension of the watermark (value and unit, e.g. {value: 100, unit: '%'}) * @param options.height - Height dimension of the watermark (value and unit, e.g. {value: 100, unit: '%'}) * @param options.top - Top position of the watermark (value and unit) * @param options.right - Right position of the watermark (value and unit) * @param options.bottom - Bottom position of the watermark (value and unit) * @param options.left - Left position of the watermark (value and unit) * @param options.rotation - Rotation of the watermark in counterclockwise degrees (default: 0) * @param options.opacity - Watermark opacity (0 is fully transparent, 1 is fully opaque) * @param options.fontFamily - Font family for the text (e.g. 'Helvetica') * @param options.fontSize - Size of the text in points * @param options.fontColor - Foreground color of the text (e.g. '#ffffff') * @param options.fontStyle - Text style array ('bold', 'italic', or both) */ watermarkText(text: string, options?: Partial<Omit<components["schemas"]["TextWatermarkAction"], "type" | "text">>): components["schemas"]["TextWatermarkAction"]; /** * Create an image watermark action * @param image - Watermark image * @param options - Watermark options * @param options.width - Width dimension of the watermark (value and unit, e.g. {value: 100, unit: '%'}) * @param options.height - Height dimension of the watermark (value and unit, e.g. {value: 100, unit: '%'}) * @param options.top - Top position of the watermark (value and unit) * @param options.right - Right position of the watermark (value and unit) * @param options.bottom - Bottom position of the watermark (value and unit) * @param options.left - Left position of the watermark (value and unit) * @param options.rotation - Rotation of the watermark in counterclockwise degrees (default: 0) * @param options.opacity - Watermark opacity (0 is fully transparent, 1 is fully opaque) */ watermarkImage(image: FileInput, options?: Partial<Omit<components["schemas"]["ImageWatermarkAction"], "type" | "image">>): ActionWithFileInput<components["schemas"]["ImageWatermarkAction"]>; /** * Create a flatten action * @param annotationIds - Optional annotation IDs to flatten (all if not specified) */ flatten(annotationIds?: (string | number)[]): components["schemas"]["FlattenAction"]; /** * Create an apply Instant JSON action * @param file - Instant JSON file input */ applyInstantJson(file: FileInput): ActionWithFileInput<components["schemas"]["ApplyInstantJsonAction"]>; /** * Create an apply XFDF action * @param file - XFDF file input * @param options - Apply Xfdf options * @param options.ignorePageRotation - If true, ignores page rotation when applying XFDF data (default: false) * @param options.richTextEnabled - If true, plain text annotations will be converted to rich text annotations. If false, all text annotations will be plain text annotations (default: true) */ applyXfdf(file: FileInput, options?: Partial<Omit<components["schemas"]["ApplyXfdfAction"], "type" | "file">>): ActionWithFileInput<components["schemas"]["ApplyXfdfAction"]>; /** * Create redactions with text search * @param text - Text to search and redact * @param options - Redaction options * @param options.content - Visual aspects of the redaction annotation (background color, overlay text, etc.) * @param strategyOptions - Redaction strategy options * @param strategyOptions.includeAnnotations - If true, redaction annotations are created on top of annotations whose content match the provided text (default: true) * @param strategyOptions.caseSensitive - If true, the search will be case sensitive (default: false) * @param strategyOptions.start - The index of the page from where to start the search (default: 0) * @param strategyOptions.limit - Starting from start, the number of pages to search (default: to the end of the document) */ createRedactionsText(text: string, options?: Omit<components["schemas"]["CreateRedactionsAction"], "type" | "strategyOptions" | "strategy">, strategyOptions?: Omit<components["schemas"]["CreateRedactionsStrategyOptionsText"], "text">): components["schemas"]["CreateRedactionsAction"]; /** * Create redactions with regex pattern * @param regex - Regex pattern to search and redact * @param options - Redaction options * @param options.content - Visual aspects of the redaction annotation (background color, overlay text, etc.) * @param strategyOptions - Redaction strategy options * @param strategyOptions.includeAnnotations - If true, redaction annotations are created on top of annotations whose content match the provided regex (default: true) * @param strategyOptions.caseSensitive - If true, the search will be case sensitive (default: true) * @param strategyOptions.start - The index of the page from where to start the search (default: 0) * @param strategyOptions.limit - Starting from start, the number of pages to search (default: to the end of the document) */ createRedactionsRegex(regex: string, options?: Omit<components["schemas"]["CreateRedactionsAction"], "type" | "strategyOptions" | "strategy">, strategyOptions?: Omit<components["schemas"]["CreateRedactionsStrategyOptionsRegex"], "regex">): components["schemas"]["CreateRedactionsAction"]; /** * Create redactions with preset pattern * @param preset - Preset pattern to search and redact (e.g. 'email-address', 'credit-card-number', 'social-security-number', etc.) * @param options - Redaction options * @param options.content - Visual aspects of the redaction annotation (background color, overlay text, etc.) * @param strategyOptions - Redaction strategy options * @param strategyOptions.includeAnnotations - If true, redaction annotations are created on top of annotations whose content match the provided preset (default: true) * @param strategyOptions.start - The index of the page from where to start the search (default: 0) * @param strategyOptions.limit - Starting from start, the number of pages to search (default: to the end of the document) */ createRedactionsPreset(preset: components["schemas"]["SearchPreset"], options?: Omit<components["schemas"]["CreateRedactionsAction"], "type" | "strategyOptions" | "strategy">, strategyOptions?: Omit<components["schemas"]["CreateRedactionsStrategyOptionsPreset"], "preset">): components["schemas"]["CreateRedactionsAction"]; /** * Apply previously created redactions */ applyRedactions(): components["schemas"]["ApplyRedactionsAction"]; }; /** * Factory functions for creating output configurations */ export declare const BuildOutputs: { /** * PDF output configuration * @param options - PDF output options */ pdf(options?: { metadata?: components["schemas"]["Metadata"]; labels?: components["schemas"]["Label"][]; userPassword?: string; ownerPassword?: string; userPermissions?: components["schemas"]["PDFUserPermission"][]; optimize?: components["schemas"]["OptimizePdf"]; }): components["schemas"]["PDFOutput"]; /** * PDF/A output configuration * @param options - PDF/A output options */ pdfa(options?: { conformance?: components["schemas"]["PDFAOutput"]["conformance"]; vectorization?: boolean; rasterization?: boolean; metadata?: components["schemas"]["Metadata"]; labels?: components["schemas"]["Label"][]; userPassword?: string; ownerPassword?: string; userPermissions?: components["schemas"]["PDFUserPermission"][]; optimize?: components["schemas"]["OptimizePdf"]; }): components["schemas"]["PDFAOutput"]; /** * PDF/UA output configuration * @param options - PDF/UA output options */ pdfua(options?: { metadata?: components["schemas"]["Metadata"]; labels?: components["schemas"]["Label"][]; userPassword?: string; ownerPassword?: string; userPermissions?: components["schemas"]["PDFUserPermission"][]; optimize?: components["schemas"]["OptimizePdf"]; }): components["schemas"]["PDFUAOutput"]; /** * Image output configuration * @param format - Image format type * @param options - Image output options */ image(format: "png" | "jpeg" | "jpg" | "webp", options?: { pages?: components["schemas"]["PageRange"]; width?: number; height?: number; dpi?: number; }): components["schemas"]["ImageOutput"]; /** * JSON content output configuration * @param options - JSON content extraction options */ jsonContent(options?: { plainText?: boolean; structuredText?: boolean; keyValuePairs?: boolean; tables?: boolean; language?: components["schemas"]["OcrLanguage"] | components["schemas"]["OcrLanguage"][]; }): components["schemas"]["JSONContentOutput"]; /** * Office document output configuration * @param type - Office document type */ office(type: "docx" | "xlsx" | "pptx"): components["schemas"]["OfficeOutput"]; /** * HTML output configuration * @param layout - The layout type to use for conversion to HTML */ html(layout: "page" | "reflow"): components["schemas"]["HTMLOutput"]; /** * Markdown output configuration */ markdown(): components["schemas"]["MarkdownOutput"]; /** * Get MIME type and filename for a given output configuration * @param output - The output configuration * @returns MIME type and optional filename */ getMimeTypeForOutput(output: Exclude<components["schemas"]["BuildOutput"], components["schemas"]["JSONContentOutput"]>): { mimeType: string; filename?: string; }; }; //# sourceMappingURL=build.d.ts.map