88
99// Imports
1010import 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' ;
1220import { createStackNavigator } from 'react-navigation-stack' ;
1321import { createAppContainer } from 'react-navigation' ;
1422
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' ;
3044
3145const fileSystem = require ( 'react-native-fs' ) ;
3246
@@ -95,6 +109,16 @@ const examples = [
95109 } ,
96110 {
97111 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' ,
98122 name : 'Event Listeners' ,
99123 description :
100124 'Show how to use the listeners exposed by the PSPDFKitView component.' ,
@@ -103,16 +127,16 @@ const examples = [
103127 } ,
104128 } ,
105129 {
106- key : 'item5 ' ,
130+ key : 'item6 ' ,
107131 name : 'Changing the State' ,
108132 description :
109133 'Add a toolbar at the bottom with buttons to toggle the annotation toolbar, and to programmatically change pages.' ,
110134 action : component => {
111135 component . props . navigation . push ( 'StateChange' ) ;
112136 } ,
113137 } ,
114- {
115- key : 'item6 ' ,
138+ {
139+ key : 'item7 ' ,
116140 name : 'Annotation Processing' ,
117141 description :
118142 'Show how to embed, flatten, remove, and print annotations; then present the newly processed document.' ,
@@ -123,15 +147,15 @@ const examples = [
123147 } ,
124148 } ,
125149 {
126- key : 'item7 ' ,
150+ key : 'item8 ' ,
127151 name : 'Programmatic Annotations' ,
128152 description : 'Show how to get and add new annotations using Instant JSON.' ,
129153 action : component => {
130154 component . props . navigation . push ( 'ProgrammaticAnnotations' ) ;
131155 } ,
132156 } ,
133157 {
134- key : 'item8 ' ,
158+ key : 'item9 ' ,
135159 name : 'Programmatic Form Filling' ,
136160 description :
137161 'Show how to get the value of a form element and how to programmatically fill forms.' ,
@@ -140,7 +164,7 @@ const examples = [
140164 } ,
141165 } ,
142166 Platform . OS === 'ios' && {
143- key : 'item9 ' ,
167+ key : 'item10 ' ,
144168 name : 'Split PDF' ,
145169 description :
146170 'Show two PDFs side by side by using multiple PSPDFKitView components.' ,
@@ -149,15 +173,15 @@ const examples = [
149173 } ,
150174 } ,
151175 Platform . OS === 'ios' && {
152- key : 'item10 ' ,
176+ key : 'item11 ' ,
153177 name : 'Customize the Toolbar' ,
154178 description : 'Show how to customize buttons in the toolbar.' ,
155179 action : component => {
156180 component . props . navigation . push ( 'ToolbarCustomization' ) ;
157181 } ,
158182 } ,
159183 {
160- key : 'item11 ' ,
184+ key : 'item12 ' ,
161185 name : 'Hidden Toolbar' ,
162186 description :
163187 'Hide the main toolbar while keeping the thumbnail bar visible.' ,
@@ -166,7 +190,7 @@ const examples = [
166190 } ,
167191 } ,
168192 {
169- key : 'item12 ' ,
193+ key : 'item13 ' ,
170194 name : 'Custom Font Picker' ,
171195 description :
172196 'Show how to customize the font picker for free text annotations.' ,
@@ -176,7 +200,7 @@ const examples = [
176200 } ,
177201 /// Present examples.
178202 {
179- key : 'item13 ' ,
203+ key : 'item14 ' ,
180204 name : 'Open a Document Using the Native Module API' ,
181205 description :
182206 'Open a document using the Native Module API by passing its path.' ,
@@ -193,7 +217,7 @@ const examples = [
193217 } ,
194218 } ,
195219 {
196- key : 'item14 ' ,
220+ key : 'item15 ' ,
197221 name : 'Customize Document Configuration' ,
198222 description :
199223 'Customize various aspects of the document by passing a configuration dictionary.' ,
@@ -202,18 +226,13 @@ const examples = [
202226 } ,
203227 } ,
204228 {
205- key : 'item15 ' ,
229+ key : 'item16 ' ,
206230 name : 'Open an Image Document Using the Native Module API' ,
207231 description :
208232 'Open an image document using the Native Module API. Supported filetypes are PNG, JPEG and TIFF.' ,
209233 action : ( ) => {
210234 // 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 ) ;
217236 } ,
218237 } ,
219238] ;
@@ -266,8 +285,7 @@ class Catalog extends Component {
266285 item . action ( this ) ;
267286 } }
268287 style = { styles . row }
269- underlayColor = { pspdfkitColor }
270- >
288+ underlayColor = { pspdfkitColor } >
271289 < View style = { styles . rowContent } >
272290 < Text style = { styles . name } > { item . name } </ Text >
273291 < Text style = { styles . description } > { item . description } </ Text >
@@ -292,6 +310,9 @@ export default createAppContainer(
292310 ManualSave : {
293311 screen : ManualSave ,
294312 } ,
313+ SaveAs : {
314+ screen : SaveAs ,
315+ } ,
295316 EventListeners : {
296317 screen : EventListeners ,
297318 } ,
@@ -366,4 +387,3 @@ var styles = StyleSheet.create({
366387 padding : 10 ,
367388 } ,
368389} ) ;
369-
0 commit comments