Installation
npm install --save @types/pdf-fill-form
Summary
This package contains type definitions for pdf-fill-form (https://github.com/tpisto/pdf-fill-form#readme).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pdf-fill-form.
index.d.ts
/// <reference types="node" />
export interface WritableFields {
[key: string]: string | boolean | number;
}
export type ReadableFields = Array<{
name: string;
page: number;
value: string;
id: number;
type: string;
}>;
export interface PdfOptions {
save?: string | undefined;
cores?: number | undefined;
scale?: number | undefined;
antialias?: boolean | undefined;
}
export interface ImgPdfOptions extends PdfOptions {
startPage?: number | undefined;
endPage?: number | undefined;
}
export type Options = PdfOptions | ImgPdfOptions;
export type WriteAsyncCallback = (err: Error, result: Buffer) => void;
export function read(sourceFile: string): Promise<ReadableFields>;
export function readSync(sourceFile: string): ReadableFields;
export function readBuffer(sourceBuffer: Buffer): Promise<ReadableFields>;
export function readBufferSync(sourceBuffer: Buffer): ReadableFields;
export function write(sourceFile: string, fields: WritableFields, options?: Options): Promise<Buffer>;
export function writeSync(sourceFile: string, fields: WritableFields, options?: Options): Buffer;
export function writeBuffer(sourceBuffer: Buffer, fields: WritableFields, options?: Options): Promise<Buffer>;
export function writeBufferSync(sourceBuffer: Buffer, fields: WritableFields, options?: Options): Buffer;
// Options are not optional here because the callback MUST be defined to avoid a crash
export function writeAsync(
sourceFile: string,
fields: WritableFields,
options: Options,
callback: WriteAsyncCallback,
): void;
Additional Details
- Last updated: Tue, 07 Nov 2023 09:09:39 GMT
- Dependencies: @types/node
Credits
These definitions were written by Grégoire Lodi.