DefinitelyTyped/types/react-native-pdf-lib/index.d.ts
Kevin Brown 388b2e06bd Added types for react-native-pdf-lib (#37314)
* Added types for react-native-pdf-lib.

* Making linter happy with default export.
2019-08-02 16:07:06 -07:00

58 lines
1.3 KiB
TypeScript

// Type definitions for react-native-pdf-lib 0.2
// Project: https://github.com/Hopding/react-native-pdf-lib#readme
// Definitions by: Kevin Brown <https://github.com/thekevinbrown>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare let PDFLib: {
getDocumentsDirectory(): string;
};
export default PDFLib;
export class PDFDocument {
static create(path: string): PDFDocument;
addPages(pages: PDFPage[]): PDFDocument;
/* Saves the document and returns the path to the file it wrote */
write(): Promise<string>;
}
export interface SetMediaBoxOptions {
x?: number;
y?: number;
}
export interface TextDrawingOptions {
x?: number;
y?: number;
color?: string;
fontName?: string;
fontSize?: number;
}
export interface RectangleDrawingOptions {
x?: number;
y?: number;
width?: number;
height?: number;
color?: string;
}
export interface ImageDrawingOptions {
x?: number;
y?: number;
width?: number;
height?: number;
}
export class PDFPage {
static create(): PDFPage;
setMediaBox(width: number, height: number, options?: SetMediaBoxOptions): PDFPage;
drawText(text: string, options?: TextDrawingOptions): PDFPage;
drawRectangle(options?: RectangleDrawingOptions): PDFPage;
drawImage(imageUri: string, options?: ImageDrawingOptions): PDFPage;
}