-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathPrintButtonExample.tsx
49 lines (44 loc) · 1.38 KB
/
PrintButtonExample.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import * as React from 'react';
import { Viewer } from '@react-pdf-viewer/core';
import { printPlugin } from '@react-pdf-viewer/print';
import '@react-pdf-viewer/core/lib/styles/index.css';
import '@react-pdf-viewer/print/lib/styles/index.css';
interface PrintButtonExampleProps {
fileUrl: string;
}
const PrintButtonExample: React.FC<PrintButtonExampleProps> = ({ fileUrl }) => {
const printPluginInstance = printPlugin();
const { PrintButton } = printPluginInstance;
return (
<div
className="rpv-core__viewer"
style={{
border: '1px solid rgba(0, 0, 0, 0.3)',
display: 'flex',
flexDirection: 'column',
height: '100%',
}}
>
<div
style={{
alignItems: 'center',
backgroundColor: '#eeeeee',
borderBottom: '1px solid rgba(0, 0, 0, 0.1)',
display: 'flex',
padding: '4px',
}}
>
<PrintButton />
</div>
<div
style={{
flex: 1,
overflow: 'hidden',
}}
>
<Viewer fileUrl={fileUrl} plugins={[printPluginInstance]} />
</div>
</div>
);
};
export default PrintButtonExample;