yagisan-reports
Version:
yagisan-reports SDK
61 lines (48 loc) • 1.32 kB
TypeScript
export const globalOptions: GlobalOptions;
type GlobalOptions = {
workerUrl: string;
fontUrl: string;
}
export declare function createEngine(params?: EngineParams): Engine;
type EngineParams = {
serviceKey?: string;
}
type Engine = {
registerUserFont(fontFamily: UserFontFamily): void;
loadTemplate(yrt: ArrayBuffer | Uint8Array): Promise<Template>;
dispose: () => void;
}
type UserFontFamily = {
name: string;
normal: UserFontFace;
bold?: UserFontFace;
}
type UserFontFace = {
buffer: Uint8Array | ArrayBuffer;
glyphData?: string;
}
type Template = {
createPdfReportGenerator(options?: CreateReportGeneratorOptions): Promise<PdfReportGenerator>;
dispose: () => void;
}
type CreateReportGeneratorOptions = {}
type PdfReportGenerator = {
generate(data: {} | null, options?: PdfReportGenerateOptions): Promise<Report>;
dispose: () => void;
}
type PdfReportGenerateOptions = {
password?: string;
advanced?: {
useObjectStreams?: boolean;
}
}
type Report = {
readonly type: "PDF";
readonly pageCount: number;
readonly pageCountPerLayout: readonly number[];
getContent: () => Promise<ArrayBuffer>;
}
export class YagisanReportsError extends Error {
type: string;
constructor(type: string, msg?: string);
}