1 | import { UnavailabilityError } from 'expo-modules-core';
|
2 | import { Platform } from 'react-native';
|
3 | import ExponentPrint from './ExponentPrint';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export const Orientation = ExponentPrint.Orientation;
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export async function printAsync(options) {
|
19 | if (Platform.OS === 'web') {
|
20 | return await ExponentPrint.print(options);
|
21 | }
|
22 | if (!options.uri && !options.html && Platform.OS === 'ios' && !options.markupFormatterIOS) {
|
23 | throw new Error('Must provide either `html` or `uri` to print');
|
24 | }
|
25 | if (options.uri && options.html) {
|
26 | throw new Error('Must provide exactly one of `html` and `uri` but both were specified');
|
27 | }
|
28 | if (options.markupFormatterIOS !== undefined) {
|
29 | console.warn('The markupFormatterIOS option is deprecated. Use useMarkupFormatter instead.');
|
30 | }
|
31 | return await ExponentPrint.print(options);
|
32 | }
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export async function selectPrinterAsync() {
|
39 | if (ExponentPrint.selectPrinter) {
|
40 | return await ExponentPrint.selectPrinter();
|
41 | }
|
42 | throw new UnavailabilityError('Print', 'selectPrinterAsync');
|
43 | }
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | export async function printToFileAsync(options = {}) {
|
51 | return await ExponentPrint.printToFileAsync(options);
|
52 | }
|
53 |
|
\ | No newline at end of file |