8
8
9
9
// Imports
10
10
import React , { Component } from 'react' ;
11
- import { FlatList , Image , processColor , StyleSheet , Text , TouchableHighlight , View } from 'react-native' ;
11
+ import {
12
+ FlatList ,
13
+ Image ,
14
+ processColor ,
15
+ StyleSheet ,
16
+ Text ,
17
+ TouchableHighlight ,
18
+ View ,
19
+ } from 'react-native' ;
12
20
import { createStackNavigator } from 'react-navigation-stack' ;
13
21
import { createAppContainer } from 'react-navigation' ;
14
22
15
- import { exampleDocumentName , exampleDocumentPath , pspdfkitColor , tiffImagePath } from "./configuration/Constants" ;
16
- import { extractFromAssetsIfMissing } from "./helpers/FileSystemHelpers" ;
17
- import { PSPDFKitViewComponent } from "./examples/PSPDFKitViewComponent" ;
18
- import { OpenImageDocument } from "./examples/OpenImageDocument" ;
19
- import { ManualSave } from "./examples/ManualSave" ;
20
- import { EventListeners } from "./examples/EventListeners" ;
21
- import { StateChange } from "./examples/StateChange" ;
22
- import { PSPDFKit } from "./helpers/PSPDFKit" ;
23
- import { AnnotationProcessing } from "./examples/AnnotationProcessing" ;
24
- import { ProgrammaticAnnotations } from "./examples/ProgrammaticAnnotations" ;
25
- import { ProgrammaticFormFilling } from "./examples/ProgrammaticFormFilling" ;
26
- import { SplitPDF } from "./examples/SplitPDF" ;
27
- import { ToolbarCustomization } from "./examples/ToolbarCustomization" ;
28
- import { HiddenToolbar } from "./examples/HiddenToolbar" ;
29
- import { CustomFontPicker } from "./examples/CustomFontPicker" ;
23
+ import {
24
+ exampleDocumentName ,
25
+ exampleDocumentPath ,
26
+ pspdfkitColor ,
27
+ tiffImagePath ,
28
+ } from './configuration/Constants' ;
29
+ import { extractFromAssetsIfMissing } from './helpers/FileSystemHelpers' ;
30
+ import { PSPDFKitViewComponent } from './examples/PSPDFKitViewComponent' ;
31
+ import { OpenImageDocument } from './examples/OpenImageDocument' ;
32
+ import { SaveAs } from './examples/SaveAs' ;
33
+ import { ManualSave } from './examples/ManualSave' ;
34
+ import { EventListeners } from './examples/EventListeners' ;
35
+ import { StateChange } from './examples/StateChange' ;
36
+ import { PSPDFKit } from './helpers/PSPDFKit' ;
37
+ import { AnnotationProcessing } from './examples/AnnotationProcessing' ;
38
+ import { ProgrammaticAnnotations } from './examples/ProgrammaticAnnotations' ;
39
+ import { ProgrammaticFormFilling } from './examples/ProgrammaticFormFilling' ;
40
+ import { SplitPDF } from './examples/SplitPDF' ;
41
+ import { ToolbarCustomization } from './examples/ToolbarCustomization' ;
42
+ import { HiddenToolbar } from './examples/HiddenToolbar' ;
43
+ import { CustomFontPicker } from './examples/CustomFontPicker' ;
30
44
31
45
const fileSystem = require ( 'react-native-fs' ) ;
32
46
@@ -95,6 +109,16 @@ const examples = [
95
109
} ,
96
110
{
97
111
key : 'item4' ,
112
+ name : 'Save As' ,
113
+ description : 'Save changes to the PDF in a separate file' ,
114
+ action : component => {
115
+ extractFromAssetsIfMissing ( exampleDocumentName , function ( ) {
116
+ component . props . navigation . push ( 'SaveAs' ) ;
117
+ } ) ;
118
+ } ,
119
+ } ,
120
+ {
121
+ key : 'item5' ,
98
122
name : 'Event Listeners' ,
99
123
description :
100
124
'Show how to use the listeners exposed by the PSPDFKitView component.' ,
@@ -103,16 +127,16 @@ const examples = [
103
127
} ,
104
128
} ,
105
129
{
106
- key : 'item5 ' ,
130
+ key : 'item6 ' ,
107
131
name : 'Changing the State' ,
108
132
description :
109
133
'Add a toolbar at the bottom with buttons to toggle the annotation toolbar, and to programmatically change pages.' ,
110
134
action : component => {
111
135
component . props . navigation . push ( 'StateChange' ) ;
112
136
} ,
113
137
} ,
114
- {
115
- key : 'item6 ' ,
138
+ {
139
+ key : 'item7 ' ,
116
140
name : 'Annotation Processing' ,
117
141
description :
118
142
'Show how to embed, flatten, remove, and print annotations; then present the newly processed document.' ,
@@ -123,15 +147,15 @@ const examples = [
123
147
} ,
124
148
} ,
125
149
{
126
- key : 'item7 ' ,
150
+ key : 'item8 ' ,
127
151
name : 'Programmatic Annotations' ,
128
152
description : 'Show how to get and add new annotations using Instant JSON.' ,
129
153
action : component => {
130
154
component . props . navigation . push ( 'ProgrammaticAnnotations' ) ;
131
155
} ,
132
156
} ,
133
157
{
134
- key : 'item8 ' ,
158
+ key : 'item9 ' ,
135
159
name : 'Programmatic Form Filling' ,
136
160
description :
137
161
'Show how to get the value of a form element and how to programmatically fill forms.' ,
@@ -140,7 +164,7 @@ const examples = [
140
164
} ,
141
165
} ,
142
166
Platform . OS === 'ios' && {
143
- key : 'item9 ' ,
167
+ key : 'item10 ' ,
144
168
name : 'Split PDF' ,
145
169
description :
146
170
'Show two PDFs side by side by using multiple PSPDFKitView components.' ,
@@ -149,15 +173,15 @@ const examples = [
149
173
} ,
150
174
} ,
151
175
Platform . OS === 'ios' && {
152
- key : 'item10 ' ,
176
+ key : 'item11 ' ,
153
177
name : 'Customize the Toolbar' ,
154
178
description : 'Show how to customize buttons in the toolbar.' ,
155
179
action : component => {
156
180
component . props . navigation . push ( 'ToolbarCustomization' ) ;
157
181
} ,
158
182
} ,
159
183
{
160
- key : 'item11 ' ,
184
+ key : 'item12 ' ,
161
185
name : 'Hidden Toolbar' ,
162
186
description :
163
187
'Hide the main toolbar while keeping the thumbnail bar visible.' ,
@@ -166,7 +190,7 @@ const examples = [
166
190
} ,
167
191
} ,
168
192
{
169
- key : 'item12 ' ,
193
+ key : 'item13 ' ,
170
194
name : 'Custom Font Picker' ,
171
195
description :
172
196
'Show how to customize the font picker for free text annotations.' ,
@@ -176,7 +200,7 @@ const examples = [
176
200
} ,
177
201
/// Present examples.
178
202
{
179
- key : 'item13 ' ,
203
+ key : 'item14 ' ,
180
204
name : 'Open a Document Using the Native Module API' ,
181
205
description :
182
206
'Open a document using the Native Module API by passing its path.' ,
@@ -193,7 +217,7 @@ const examples = [
193
217
} ,
194
218
} ,
195
219
{
196
- key : 'item14 ' ,
220
+ key : 'item15 ' ,
197
221
name : 'Customize Document Configuration' ,
198
222
description :
199
223
'Customize various aspects of the document by passing a configuration dictionary.' ,
@@ -202,18 +226,13 @@ const examples = [
202
226
} ,
203
227
} ,
204
228
{
205
- key : 'item15 ' ,
229
+ key : 'item16 ' ,
206
230
name : 'Open an Image Document Using the Native Module API' ,
207
231
description :
208
232
'Open an image document using the Native Module API. Supported filetypes are PNG, JPEG and TIFF.' ,
209
233
action : ( ) => {
210
234
// PSPDFKit can open PNG, JPEG and TIFF image files directly.
211
- if ( Platform . OS === 'ios' ) {
212
- PSPDFKit . present ( tiffImagePath , tiffImageConfiguration ) ;
213
- }
214
- if ( Platform . OS === 'android' ) {
215
- PSPDFKit . presentImage ( tiffImagePath , tiffImageConfiguration ) ;
216
- }
235
+ PSPDFKit . present ( tiffImagePath , tiffImageConfiguration ) ;
217
236
} ,
218
237
} ,
219
238
] ;
@@ -266,8 +285,7 @@ class Catalog extends Component {
266
285
item . action ( this ) ;
267
286
} }
268
287
style = { styles . row }
269
- underlayColor = { pspdfkitColor }
270
- >
288
+ underlayColor = { pspdfkitColor } >
271
289
< View style = { styles . rowContent } >
272
290
< Text style = { styles . name } > { item . name } </ Text >
273
291
< Text style = { styles . description } > { item . description } </ Text >
@@ -292,6 +310,9 @@ export default createAppContainer(
292
310
ManualSave : {
293
311
screen : ManualSave ,
294
312
} ,
313
+ SaveAs : {
314
+ screen : SaveAs ,
315
+ } ,
295
316
EventListeners : {
296
317
screen : EventListeners ,
297
318
} ,
@@ -366,4 +387,3 @@ var styles = StyleSheet.create({
366
387
padding : 10 ,
367
388
} ,
368
389
} ) ;
369
-
0 commit comments