UNPKG

3.54 kBTypeScriptView Raw
1export declare type PrintOptions = {
2 /**
3 * URI of a PDF file to print. Remote, local (ex. selected via `DocumentPicker`) or base64 data URI
4 * starting with `data:application/pdf;base64,`. This only supports PDF, not other types of
5 * document (e.g. images). **Available on Android and iOS only.**
6 */
7 uri?: string;
8 /**
9 * HTML string to print. **Available on Android and iOS only.**
10 */
11 html?: string;
12 /**
13 * Width of the single page in pixels. Defaults to `612` which is a width of US Letter paper
14 * format with 72 PPI. **Available only with `html` option.**
15 */
16 width?: number;
17 /**
18 * Height of the single page in pixels. Defaults to `792` which is a height of US Letter paper
19 * format with 72 PPI. **Available only with `html` option.**
20 */
21 height?: number;
22 /**
23 * URL of the printer to use. Returned from `selectPrinterAsync`. **Available on iOS only.**
24 */
25 printerUrl?: string;
26 /**
27 * **Available on iOS only.** Alternative to default option that uses [UIMarkupTextPrintFormatter](https://developer.apple.com/documentation/uikit/uimarkuptextprintformatter)
28 * instead of WebView, but it doesn't display images.
29 */
30 useMarkupFormatter?: boolean;
31 /**
32 * @deprecated
33 * **Available on iOS only.** This argument is deprecated, use `useMarkupFormatter` instead.
34 * Might be removed in the future releases.
35 */
36 markupFormatterIOS?: string;
37 /**
38 * **Available on iOS only.** The orientation of the printed content, `Print.Orientation.portrait`
39 * or `Print.Orientation.landscape`.
40 */
41 orientation?: OrientationType['portrait'] | OrientationType['landscape'];
42};
43export declare type Printer = {
44 /**
45 * Name of the printer.
46 */
47 name: string;
48 /**
49 * URL of the printer.
50 */
51 url: string;
52};
53/**
54 * The possible values of orientation for the printed content.
55 */
56export interface OrientationType {
57 portrait: string;
58 landscape: string;
59}
60export declare type FilePrintOptions = {
61 /**
62 * HTML string to print into PDF file.
63 */
64 html?: string;
65 /**
66 * **Available on iOS only.** Alternative to default option that uses [UIMarkupTextPrintFormatter](https://developer.apple.com/documentation/uikit/uimarkuptextprintformatter)
67 * instead of WebView, but it doesn't display images.
68 */
69 useMarkupFormatter?: boolean;
70 /**
71 * Width of the single page in pixels. Defaults to `612` which is a width of US Letter paper
72 * format with 72 PPI.
73 */
74 width?: number;
75 /**
76 * Height of the single page in pixels. Defaults to `792` which is a height of US Letter paper
77 * format with 72 PPI.
78 */
79 height?: number;
80 /**
81 * Padding for the printed document.
82 */
83 padding?: FilePrintPadding;
84 /**
85 * Whether to include base64 encoded string of the file in the returned object.
86 */
87 base64?: boolean;
88};
89export declare type FilePrintPadding = {
90 top: number;
91 right: number;
92 bottom: number;
93 left: number;
94};
95export declare type FilePrintResult = {
96 /**
97 * A URI to the printed PDF file.
98 */
99 uri: string;
100 /**
101 * Number of pages that were needed to render given content.
102 */
103 numberOfPages: number;
104 /**
105 * Base64 encoded string containing the data of the PDF file. **Available only if `base64`
106 * option is truthy**. It doesn't include data URI prefix `data:application/pdf;base64,`.
107 */
108 base64?: string;
109};