react-pdf-printer
Version:
Create pdf document using React
106 lines (93 loc) • 3.85 kB
TypeScript
/// <reference types="react" />
import React from 'react';
declare type Orientation$1 = 'landscape' | 'portrait';
declare type Size$1 = number | [number, number] | PageSize$1;
declare type PageSize$1 = 'a3' | 'a4' | 'a5' | 'b4' | 'b5' | 'jis-b4' | 'jis-b5' | 'letter' | 'legal' | 'ledger';
declare type PaginationConfiguration$1 = {
format: string;
formatPage: string;
formatTotal: string;
style: string;
};
declare type PrinterConfiguration$1 = {
orientation: Orientation$1;
size: Size$1;
pagination: PaginationConfiguration$1;
useAsync: boolean;
};
declare type DocumentConfiguration$1 = Omit<PrinterConfiguration$1, 'orientation' | 'size'>;
declare type DeepPartial<T extends Object> = {
[K in keyof T]?: T[K] extends Object ? DeepPartial<T[K]> : T[K] | undefined;
};
declare type SectionProps = {
children: React.ReactNode;
};
declare type ArticleProps = SectionProps & {
header?: React.ReactNode;
footer?: React.ReactNode;
};
declare type PortalDocumentProps = {
configuration?: DeepPartial<DocumentConfiguration$1>;
header: React.ReactNode;
footer: React.ReactNode;
onRender?: () => void;
children: React.ReactNode;
};
declare type DocumentRef = {
render: () => void;
};
declare type ScreenProps = {
isRendering: boolean;
};
declare type ScreenElement = React.ReactElement<ScreenProps, React.JSXElementConstructor<any>>;
declare type DocumentProps = PortalDocumentProps & {
title?: string;
renderOnInit?: boolean;
screen: ScreenElement | ((screenProps: ScreenProps) => ScreenElement);
};
declare type PageProps = ArticleProps;
declare const Page: ({ header, footer, children }: PageProps) => JSX.Element;
declare type PagesProps = ArticleProps;
declare const Pages: ({ header, footer, children }: PagesProps) => JSX.Element;
declare const _default$1: React.ForwardRefExoticComponent<PortalDocumentProps & {
title?: string | undefined;
renderOnInit?: boolean | undefined;
screen: React.ReactElement<{
isRendering: boolean;
}, React.JSXElementConstructor<any>> | ((screenProps: {
isRendering: boolean;
}) => React.ReactElement<{
isRendering: boolean;
}, React.JSXElementConstructor<any>>);
} & React.RefAttributes<DocumentRef>>;
declare const _default: React.ForwardRefExoticComponent<PortalDocumentProps & React.RefAttributes<DocumentRef>>;
declare const Pagination: React.FC;
declare type PrinterProviderProps = {
configuration?: DeepPartial<PrinterConfiguration$1>;
children: React.ReactNode;
};
declare const PrinterProvider: ({ configuration, children }: PrinterProviderProps) => JSX.Element;
declare type UsePrinterResult = {
isPrinter: boolean;
isRendering: boolean;
subscribe: () => void;
run: () => void;
};
declare const usePrinter: (key?: string | undefined) => UsePrinterResult;
declare type Orientation = 'landscape' | 'portrait';
declare type Size = number | [number, number] | PageSize;
declare type PageSize = 'a3' | 'a4' | 'a5' | 'b4' | 'b5' | 'jis-b4' | 'jis-b5' | 'letter' | 'legal' | 'ledger';
declare type PaginationConfiguration = {
format: string;
formatPage: string;
formatTotal: string;
style: string;
};
declare type PrinterConfiguration = {
orientation: Orientation;
size: Size;
pagination: PaginationConfiguration;
useAsync: boolean;
};
declare type DocumentConfiguration = Omit<PrinterConfiguration, 'orientation' | 'size'>;
export { _default$1 as Document, type DocumentConfiguration, type DocumentProps, type DocumentRef, type Orientation, Page, type PageProps, type PageSize, Pages, type PagesProps, Pagination, type PaginationConfiguration, _default as PortalDocument, type PortalDocumentProps, type PrinterConfiguration, PrinterProvider, type PrinterProviderProps, type Size, type UsePrinterResult, usePrinter };