0.2.3 • Published 6 months ago

@types/react-native-pdf-lib v0.2.3

Weekly downloads
68
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/react-native-pdf-lib

Summary

This package contains type definitions for react-native-pdf-lib (https://github.com/Hopding/react-native-pdf-lib#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-native-pdf-lib.

index.d.ts

// 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 | undefined;
    y?: number | undefined;
}

export interface TextDrawingOptions {
    x?: number | undefined;
    y?: number | undefined;
    color?: string | undefined;
    fontName?: string | undefined;
    fontSize?: number | undefined;
}

export interface RectangleDrawingOptions {
    x?: number | undefined;
    y?: number | undefined;
    width?: number | undefined;
    height?: number | undefined;
    color?: string | undefined;
}

export interface ImageDrawingOptions {
    x?: number | undefined;
    y?: number | undefined;
    width?: number | undefined;
    height?: number | undefined;
}

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;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 22:41:14 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Kevin Brown.