forked from VadimDez/ng2-pdf-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.component.html
executable file
·194 lines (177 loc) · 9.95 KB
/
app.component.html
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<div mdl class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--no-drawer-button">
<header class="mdl-layout__header mdl-layout__header--waterfall">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title">ng2-pdf-viewer</span>
<div class="mdl-layout-spacer"></div>
<iframe src="https://ghbtns.com/github-btn.html?user=vadimdez&repo=ng2-pdf-viewer&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe>
</div>
</header>
<main class="mdl-layout__content">
<header>
<div class="page-content">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path d="M21 13v-3l-6-7h-10.997c-1.106 0-2.003 0.898-2.003 2.007v22.985c0 1.109 0.891 2.007 1.997 2.007h15.005c1.103 0 1.997-0.898 1.997-1.991v-2.009h7.993c1.661 0 3.007-1.342 3.007-2.999v-7.002c0-1.656-1.336-2.999-3.007-2.999h-7.993zM20 26v2.007c0 0.548-0.448 0.993-1 0.993h-15c-0.545 0-1-0.446-1-0.995v-23.009c0-0.54 0.446-0.995 0.996-0.995h10.004v4.994c0 1.119 0.895 2.006 1.998 2.006h4.002v2h-7.993c-1.661 0-3.007 1.342-3.007 2.999v7.002c0 1.656 1.336 2.999 3.007 2.999h7.993zM15 4.5l4.7 5.5h-3.703c-0.546 0-0.997-0.452-0.997-1.009v-4.491zM11.995 14h17.011c1.092 0 1.995 0.892 1.995 1.992v7.016c0 1.092-0.893 1.992-1.995 1.992h-17.011c-1.092 0-1.995-0.892-1.995-1.992v-7.016c0-1.092 0.893-1.992 1.995-1.992zM25 19v-2h4v-1h-5v7h1v-3h3v-1h-3zM12 18v-2h2.995c1.111 0 2.005 0.895 2.005 2 0 1.112-0.898 2-2.005 2h-1.995v3h-1v-5zM13 17v2h2.001c0.552 0 0.999-0.444 0.999-1 0-0.552-0.443-1-0.999-1h-2.001zM18 16h2.995c1.111 0 2.005 0.898 2.005 2.006v2.988c0 1.119-0.898 2.006-2.005 2.006h-2.995v-7zM19 17v5h2.001c0.552 0 0.999-0.444 0.999-1v-3c0-0.552-0.443-1-0.999-1h-2.001z"></path>
</svg>
<h2>Angular 2+ PDF Viewer</h2>
<p>Angular 2+ Component to render PDF</p>
</div>
</header>
<div class="page-content">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input [(ngModel)]="pdfSrc" [value]="pdfSrc" class="mdl-textfield__input" type="text" id="pdf-src">
<label class="mdl-textfield__label" for="pdf-src">Set URL of the PDF file</label>
</div>
<div class="select-file__container">
<p>
Or render preview by just selecting PDF file (no upload required)
</p>
<input (change)="onFileSelected()" type="file" id="file">
</div>
<div *ngIf="error" class="error mb">
{{ error.message | json }}
</div>
<div class="mb">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="original-size">
<input type="checkbox" id="original-size" class="mdl-switch__input"
[checked]="originalSize"
[(ngModel)]="originalSize"
>
<span class="mdl-switch__label">Original size</span>
</label>
</div>
<div class="mb" [hidden]="!originalSize">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="fit-to-size">
<input type="checkbox" id="fit-to-size" class="mdl-switch__input"
[checked]="fitToPage"
[(ngModel)]="fitToPage"
>
<span class="mdl-switch__label">Fit to page</span>
</label>
</div>
<div class="mb">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="render-text">
<input type="checkbox" id="render-text" class="mdl-switch__input"
[checked]="renderText"
[(ngModel)]="renderText"
>
<span class="mdl-switch__label">Render text layer</span>
</label>
</div>
<div class="mb">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="autoresize">
<input type="checkbox" id="autoresize" class="mdl-switch__input"
[checked]="autoresize"
[(ngModel)]="autoresize"
>
<span class="mdl-switch__label">Auto resize</span>
</label>
</div>
<div class="mb">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="show-all">
<input type="checkbox" id="show-all" class="mdl-switch__input"
[checked]="showAll"
[(ngModel)]="showAll"
>
<span class="mdl-switch__label">Show all pages</span>
</label>
</div>
<div mdl>
<button (click)="incrementZoom(-0.1)" class="mdl-button mdl-js-button">
-
</button>
<div class="page-number mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input [(ngModel)]="zoom"
[value]="zoom"
class="mdl-textfield__input"
type="number"
pattern="-?[0-9]*(\.[0-9]+)?"
id="pdf-zoom"
>
<label class="mdl-textfield__label" for="pdf-zoom">Zoom</label>
<span class="mdl-textfield__error">Input is not a number!</span>
</div>
<button (click)="incrementZoom(0.1)" class="mdl-button mdl-js-button">
+
</button>
</div>
<div *ngIf="showAll">
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect" for="stick-to-page">
<input type="checkbox" id="stick-to-page" class="mdl-switch__input"
[checked]="stickToPage"
[(ngModel)]="stickToPage"
>
<span class="mdl-switch__label">Stick to page</span>
</label>
</div>
<div mdl *ngIf="stickToPage && showAll || !showAll">
<button (click)="incrementPage(-1)" class="mdl-button mdl-js-button">
Previous
</button>
<div class="page-number mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input [(ngModel)]="page"
[value]="page"
class="mdl-textfield__input"
type="number"
pattern="-?[0-9]*(\.[0-9]+)?"
id="pdf-page"
>
<label class="mdl-textfield__label" for="pdf-page">Page</label>
<span class="mdl-textfield__error">Input is not a number!</span>
</div>
<span *ngIf="pdf">of {{ pdf.numPages }}</span>
<button (click)="incrementPage(1)" class="mdl-button mdl-js-button">
Next
</button>
</div>
<div>
<button (click)="rotate(-90)" class="mdl-button mdl-js-button">Rotate left</button>
<div class="page-number mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input [value]="rotation"
class="mdl-textfield__input"
type="number"
disabled
>
<label class="mdl-textfield__label" for="pdf-page">Angle</label>
</div>
<button (click)="rotate(90)" class="mdl-button mdl-js-button">Rotate right</button>
</div>
<div *ngIf="!isLoaded && !error && progressData" id="progress">
<div class="bg">
<div class="bar" [style.width]="progressData.loaded / progressData.total * 100 + '%'"></div>
</div>
<span>{{ getInt(progressData.loaded / progressData.total * 100) }}%</span>
</div>
<pdf-viewer [src]="pdfSrc"
[(page)]="page"
[rotation]="rotation"
[original-size]="originalSize"
[fit-to-page]="fitToPage"
(after-load-complete)="afterLoadComplete($event)"
[zoom]="zoom"
[show-all]="showAll"
[stick-to-page]="stickToPage"
[render-text]="renderText"
[external-link-target]="'blank'"
[autoresize]="autoresize"
(error)="onError($event)"
(on-progress)="onProgress($event)"
></pdf-viewer>
</div>
<footer class="mdl-mini-footer">
<div class="mdl-mini-footer__left-section">
<div class="mdl-logo">ng2-pdf-viewer</div>
<ul class="mdl-mini-footer__link-list">
<li>
<iframe src="https://ghbtns.com/github-btn.html?user=vadimdez&type=follow&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe>
</li>
<li>
<iframe src="https://ghbtns.com/github-btn.html?user=vadimdez&repo=ng2-pdf-viewer&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
</li>
<li>
<iframe src="https://ghbtns.com/github-btn.html?user=vadimdez&repo=ng2-pdf-viewer&type=fork&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe>
</li>
</ul>
</div>
</footer>
</main>
</div>