├── .DS_Store
├── .gitignore
├── .gradle
├── 4.3
│ ├── fileChanges
│ │ └── last-build.bin
│ ├── fileHashes
│ │ └── fileHashes.lock
│ └── taskHistory
│ │ ├── taskHistory.bin
│ │ └── taskHistory.lock
└── buildOutputCleanup
│ ├── buildOutputCleanup.lock
│ └── cache.properties
├── .idea
├── .gitignore
├── codeStyles
│ └── Project.xml
├── modules.xml
├── pdf-generator-example.iml
└── vcs.xml
├── README.md
├── android.sh
├── config.xml
├── docs
├── android-demo.gif
└── ios-demo.gif
├── hooks
└── README.md
├── ios.sh
├── package-lock.json
├── package.json
└── www
├── bundle.js
├── css
└── index.css
├── full.html
├── img
├── fractal.jpeg
└── logo.png
├── index.html
├── js
└── index.js
├── package.json
├── test.html
└── webpack.config.js
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 |
6 | # Runtime data
7 | pids
8 | *.pid
9 | *.seed
10 | *.pdf
11 |
12 | # Directory for instrumented libs generated by jscoverage/JSCover
13 | lib-cov
14 |
15 | # Coverage directory used by tools like istanbul
16 | coverage
17 |
18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
19 | .grunt
20 |
21 | # node-waf configuration
22 | .lock-wscript
23 |
24 | # Compiled binary addons (http://nodejs.org/api/addons.html)
25 | build/Release
26 |
27 | # Dependency directories
28 | node_modules
29 | jspm_packages
30 |
31 | # Optional npm cache directory
32 | .npm
33 |
34 | # Optional REPL history
35 | .node_repl_history
36 | platforms
37 | plugins
38 |
39 |
40 | # Xcode
41 | !**/*.xcodeproj
42 | !**/*.pbxproj
43 | !**/*.xcworkspacedata
44 | !**/*.xcsettings
45 | !**/*.xcscheme
46 | *.pbxuser
47 | !default.pbxuser
48 | *.mode1v3
49 | !default.mode1v3
50 | *.mode2v3
51 | !default.mode2v3
52 | *.perspectivev3
53 | !default.perspectivev3
54 | xcuserdata
55 | *.xccheckout
56 | *.moved-aside
57 | DerivedData
58 | *.hmap
59 | *.ipa
60 | *.xcuserstate
61 | project.xcworkspace
62 |
63 | # Gradle
64 | /build/
65 | /RNTester/android/app/build/
66 | /RNTester/android/app/gradle/
67 | /RNTester/android/app/gradlew
68 | /RNTester/android/app/gradlew.bat
69 | /ReactAndroid/build/
70 | /ReactAndroid/gradle/
71 | /ReactAndroid/gradlew
72 | /ReactAndroid/gradlew.bat
73 |
74 | # Buck
75 | .buckd
76 | buck-out
77 | /ReactAndroid/src/main/jni/prebuilt/lib/
78 | /ReactAndroid/src/main/gen
79 |
80 | # Android Studio
81 | .project
82 | .settings
83 | .classpath
84 |
85 | # Watchman
86 | .watchmanconfig
87 |
88 | # Android
89 | .idea
90 | .gradle
91 | local.properties
92 | *.iml
93 | /android/
94 |
95 | # Node
96 | node_modules
97 | *.log
98 | .nvm
99 | /bots/node_modules/
100 | package-lock.json
101 |
102 | # OS X
103 | .DS_Store
104 |
105 | # Test generated files
106 | /ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
107 | *.js.meta
108 |
109 | /coverage
110 | /third-party
111 |
112 | # Root dir shouldn't have Xcode project
113 | /*.xcodeproj
114 |
115 | # ReactCommon subdir shouldn't have Xcode project
116 | /ReactCommon/**/*.xcodeproj
117 | RNTester/build
118 |
119 | # Libs that shouldn't have Xcode project
120 | /Libraries/FBLazyVector/**/*.xcodeproj
121 | /Libraries/FBReactNativeSpec/**/*.xcodeproj
122 | /Libraries/RCTRequired/**/*.xcodeproj
123 | /React/CoreModules/**/*.xcodeproj
124 | /packages/react-native-codegen/**/*.xcodeproj
125 |
126 | # CocoaPods
127 | /template/ios/Pods/
128 | /template/ios/Podfile.lock
129 | /RNTester/Gemfile.lock
130 |
131 | # Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
132 | RNTester/Pods/*
133 | !RNTester/Pods/__offline_mirrors
134 |
135 | # react-native-codegen
136 | /ReactCommon/fabric/components/rncore/
137 | /schema-rncore.json
138 |
139 | # Visual studio
140 | .vscode
141 | .vs
142 |
--------------------------------------------------------------------------------
/.gradle/4.3/fileChanges/last-build.bin:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gradle/4.3/fileHashes/fileHashes.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/.gradle/4.3/fileHashes/fileHashes.lock
--------------------------------------------------------------------------------
/.gradle/4.3/taskHistory/taskHistory.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/.gradle/4.3/taskHistory/taskHistory.bin
--------------------------------------------------------------------------------
/.gradle/4.3/taskHistory/taskHistory.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/.gradle/4.3/taskHistory/taskHistory.lock
--------------------------------------------------------------------------------
/.gradle/buildOutputCleanup/buildOutputCleanup.lock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/.gradle/buildOutputCleanup/buildOutputCleanup.lock
--------------------------------------------------------------------------------
/.gradle/buildOutputCleanup/cache.properties:
--------------------------------------------------------------------------------
1 | #Wed Nov 15 14:57:48 GMT 2017
2 | gradle.version=4.3
3 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /workspace.xml
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/pdf-generator-example.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## PDF Generator Cordova
3 |
4 | This is just a demo showcasing the pdf generator Cordova plugin
5 |
6 |
7 | ## Getting started.
8 |
9 | ```sh
10 | git clone https://github.com/cesarvr/pdf-generator-example sample
11 | cd sample
12 | cordova platform add ios android
13 | ```
14 |
15 | For the web application I'm using [Webpack](https://webpack.github.io/) and [Backbone](https://webpack.github.io/), is just a simple web app if you want to do some modifications you need to:
16 |
17 | ```sh
18 | cd www/
19 | npm install
20 | npm webpack -g # if you don't have webpack.
21 | webpack --watch
22 | ```
23 |
24 | This will build automatically the source files and you can use your favorite static server to serve the www/ folder for example:
25 |
26 | ```sh
27 |
28 | cordova serve
29 |
30 | #or
31 |
32 | cd www/ && python -m SimpleHTTPServer 8080
33 |
34 | ```
35 |
36 | to run the app on the device:
37 |
38 | ```sh
39 | cordova plugin add cordova-pdf-generator
40 | cordova build #ios android
41 | cordova run ios #android
42 | ```
43 |
44 | ## Demo
45 |
46 | ### Android version.
47 | 
48 |
49 | ### IOS Version
50 | 
51 |
--------------------------------------------------------------------------------
/android.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd www/ && webpack && cd .. && cordova plugin remove cordova-pdf-generator && cordova plugins add ../pdf-generator && cordova prepare && cordova run android --info && adb logcat | grep 'PDF'
4 |
--------------------------------------------------------------------------------
/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Testing
4 |
5 | A sample Apache Cordova application that responds to the deviceready event.
6 |
7 |
8 | Apache Cordova Team
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/docs/android-demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/docs/android-demo.gif
--------------------------------------------------------------------------------
/docs/ios-demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/docs/ios-demo.gif
--------------------------------------------------------------------------------
/hooks/README.md:
--------------------------------------------------------------------------------
1 |
21 | # Cordova Hooks
22 |
23 | Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order:
24 | * Application hooks from `/hooks`;
25 | * Application hooks from `config.xml`;
26 | * Plugin hooks from `plugins/.../plugin.xml`.
27 |
28 | __Remember__: Make your scripts executable.
29 |
30 | __Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated.
31 |
32 | ## Supported hook types
33 | The following hook types are supported:
34 |
35 | after_build/
36 | after_compile/
37 | after_docs/
38 | after_emulate/
39 | after_platform_add/
40 | after_platform_rm/
41 | after_platform_ls/
42 | after_plugin_add/
43 | after_plugin_ls/
44 | after_plugin_rm/
45 | after_plugin_search/
46 | after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed
47 | after_prepare/
48 | after_run/
49 | after_serve/
50 | before_build/
51 | before_compile/
52 | before_docs/
53 | before_emulate/
54 | before_platform_add/
55 | before_platform_rm/
56 | before_platform_ls/
57 | before_plugin_add/
58 | before_plugin_ls/
59 | before_plugin_rm/
60 | before_plugin_search/
61 | before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed
62 | before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled
63 | before_prepare/
64 | before_run/
65 | before_serve/
66 | pre_package/ <-- Windows 8 and Windows Phone only.
67 |
68 | ## Ways to define hooks
69 | ### Via '/hooks' directory
70 | To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example:
71 |
72 | # script file will be automatically executed after each build
73 | hooks/after_build/after_build_custom_action.js
74 |
75 |
76 | ### Config.xml
77 |
78 | Hooks can be defined in project's `config.xml` using `` elements, for example:
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | ...
89 |
90 |
91 |
92 |
93 |
94 |
95 | ...
96 |
97 |
98 | ### Plugin hooks (plugin.xml)
99 |
100 | As a plugin developer you can define hook scripts using `` elements in a `plugin.xml` like that:
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | ...
109 |
110 |
111 | `before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled.
112 |
113 | ## Script Interface
114 |
115 | ### Javascript
116 |
117 | If you are writing hooks in Javascript you should use the following module definition:
118 | ```javascript
119 | module.exports = function(context) {
120 | ...
121 | }
122 | ```
123 |
124 | You can make your scipts async using Q:
125 | ```javascript
126 | module.exports = function(context) {
127 | var Q = context.requireCordovaModule('q');
128 | var deferral = new Q.defer();
129 |
130 | setTimeout(function(){
131 | console.log('hook.js>> end');
132 | deferral.resolve();
133 | }, 1000);
134 |
135 | return deferral.promise;
136 | }
137 | ```
138 |
139 | `context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object:
140 | ```json
141 | {
142 | "hook": "before_plugin_install",
143 | "scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js",
144 | "cmdLine": "The\\exact\\command\\cordova\\run\\with arguments",
145 | "opts": {
146 | "projectRoot":"C:\\path\\to\\the\\project",
147 | "cordova": {
148 | "platforms": ["wp8"],
149 | "plugins": ["com.plugin.withhooks"],
150 | "version": "0.21.7-dev"
151 | },
152 | "plugin": {
153 | "id": "com.plugin.withhooks",
154 | "pluginInfo": {
155 | ...
156 | },
157 | "platform": "wp8",
158 | "dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks"
159 | }
160 | },
161 | "cordova": {...}
162 | }
163 |
164 | ```
165 | `context.opts.plugin` object will only be passed to plugin hooks scripts.
166 |
167 | You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way:
168 | ```javascript
169 | var Q = context.requireCordovaModule('q');
170 | ```
171 |
172 | __Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only.
173 | For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below.
174 |
175 | ### Non-javascript
176 |
177 | Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
178 |
179 | * CORDOVA_VERSION - The version of the Cordova-CLI.
180 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
181 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
182 | * CORDOVA_HOOK - Path to the hook that is being executed.
183 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
184 |
185 | If a script returns a non-zero exit code, then the parent cordova command will be aborted.
186 |
187 | ## Writing hooks
188 |
189 | We highly recommend writing your hooks using Node.js so that they are
190 | cross-platform. Some good examples are shown here:
191 |
192 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
193 |
194 | Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example:
195 |
196 | #!/usr/bin/env [name_of_interpreter_executable]
197 |
--------------------------------------------------------------------------------
/ios.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd www/ && webpack && cd .. && cordova plugin remove cordova-pdf-generator && cordova plugins add ../pdf-generator && cordova prepare && cordova run ios
4 |
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pdf-generator-test",
3 | "version": "1.0.0",
4 | "lockfileVersion": 1,
5 | "requires": true,
6 | "dependencies": {
7 | "backbone": {
8 | "version": "1.4.0",
9 | "resolved": "https://registry.npmjs.org/backbone/-/backbone-1.4.0.tgz",
10 | "integrity": "sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ==",
11 | "requires": {
12 | "underscore": ">=1.8.3"
13 | }
14 | },
15 | "cordova-android": {
16 | "version": "6.4.0",
17 | "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-6.4.0.tgz",
18 | "integrity": "sha1-VK6NpXKKjX5e/MYXLT3MoXvH/n0=",
19 | "requires": {
20 | "android-versions": "^1.2.1",
21 | "cordova-common": "^2.1.0",
22 | "elementtree": "0.1.6",
23 | "nopt": "^3.0.1",
24 | "properties-parser": "^0.2.3",
25 | "q": "^1.4.1",
26 | "shelljs": "^0.5.3"
27 | },
28 | "dependencies": {
29 | "abbrev": {
30 | "version": "1.1.0",
31 | "bundled": true
32 | },
33 | "android-versions": {
34 | "version": "1.2.1",
35 | "bundled": true
36 | },
37 | "ansi": {
38 | "version": "0.3.1",
39 | "bundled": true
40 | },
41 | "balanced-match": {
42 | "version": "1.0.0",
43 | "bundled": true
44 | },
45 | "base64-js": {
46 | "version": "0.0.8",
47 | "bundled": true
48 | },
49 | "big-integer": {
50 | "version": "1.6.25",
51 | "bundled": true
52 | },
53 | "bplist-parser": {
54 | "version": "0.1.1",
55 | "bundled": true,
56 | "requires": {
57 | "big-integer": "^1.6.7"
58 | }
59 | },
60 | "brace-expansion": {
61 | "version": "1.1.8",
62 | "bundled": true,
63 | "requires": {
64 | "balanced-match": "^1.0.0",
65 | "concat-map": "0.0.1"
66 | }
67 | },
68 | "concat-map": {
69 | "version": "0.0.1",
70 | "bundled": true
71 | },
72 | "cordova-common": {
73 | "version": "2.1.0",
74 | "bundled": true,
75 | "requires": {
76 | "ansi": "^0.3.1",
77 | "bplist-parser": "^0.1.0",
78 | "cordova-registry-mapper": "^1.1.8",
79 | "elementtree": "0.1.6",
80 | "glob": "^5.0.13",
81 | "minimatch": "^3.0.0",
82 | "osenv": "^0.1.3",
83 | "plist": "^1.2.0",
84 | "q": "^1.4.1",
85 | "semver": "^5.0.1",
86 | "shelljs": "^0.5.3",
87 | "underscore": "^1.8.3",
88 | "unorm": "^1.3.3"
89 | }
90 | },
91 | "cordova-registry-mapper": {
92 | "version": "1.1.15",
93 | "bundled": true
94 | },
95 | "elementtree": {
96 | "version": "0.1.6",
97 | "bundled": true,
98 | "requires": {
99 | "sax": "0.3.5"
100 | }
101 | },
102 | "glob": {
103 | "version": "5.0.15",
104 | "bundled": true,
105 | "requires": {
106 | "inflight": "^1.0.4",
107 | "inherits": "2",
108 | "minimatch": "2 || 3",
109 | "once": "^1.3.0",
110 | "path-is-absolute": "^1.0.0"
111 | }
112 | },
113 | "inflight": {
114 | "version": "1.0.6",
115 | "bundled": true,
116 | "requires": {
117 | "once": "^1.3.0",
118 | "wrappy": "1"
119 | }
120 | },
121 | "inherits": {
122 | "version": "2.0.3",
123 | "bundled": true
124 | },
125 | "lodash": {
126 | "version": "3.10.1",
127 | "bundled": true
128 | },
129 | "minimatch": {
130 | "version": "3.0.4",
131 | "bundled": true,
132 | "requires": {
133 | "brace-expansion": "^1.1.7"
134 | }
135 | },
136 | "nopt": {
137 | "version": "3.0.6",
138 | "bundled": true,
139 | "requires": {
140 | "abbrev": "1"
141 | }
142 | },
143 | "once": {
144 | "version": "1.4.0",
145 | "bundled": true,
146 | "requires": {
147 | "wrappy": "1"
148 | }
149 | },
150 | "os-homedir": {
151 | "version": "1.0.2",
152 | "bundled": true
153 | },
154 | "os-tmpdir": {
155 | "version": "1.0.2",
156 | "bundled": true
157 | },
158 | "osenv": {
159 | "version": "0.1.4",
160 | "bundled": true,
161 | "requires": {
162 | "os-homedir": "^1.0.0",
163 | "os-tmpdir": "^1.0.0"
164 | }
165 | },
166 | "path-is-absolute": {
167 | "version": "1.0.1",
168 | "bundled": true
169 | },
170 | "plist": {
171 | "version": "1.2.0",
172 | "bundled": true,
173 | "requires": {
174 | "base64-js": "0.0.8",
175 | "util-deprecate": "1.0.2",
176 | "xmlbuilder": "4.0.0",
177 | "xmldom": "0.1.x"
178 | }
179 | },
180 | "properties-parser": {
181 | "version": "0.2.3",
182 | "bundled": true
183 | },
184 | "q": {
185 | "version": "1.5.0",
186 | "bundled": true
187 | },
188 | "sax": {
189 | "version": "0.3.5",
190 | "bundled": true
191 | },
192 | "semver": {
193 | "version": "5.4.1",
194 | "bundled": true
195 | },
196 | "shelljs": {
197 | "version": "0.5.3",
198 | "bundled": true
199 | },
200 | "underscore": {
201 | "version": "1.8.3",
202 | "bundled": true
203 | },
204 | "unorm": {
205 | "version": "1.4.1",
206 | "bundled": true
207 | },
208 | "util-deprecate": {
209 | "version": "1.0.2",
210 | "bundled": true
211 | },
212 | "wrappy": {
213 | "version": "1.0.2",
214 | "bundled": true
215 | },
216 | "xmlbuilder": {
217 | "version": "4.0.0",
218 | "bundled": true,
219 | "requires": {
220 | "lodash": "^3.5.0"
221 | }
222 | },
223 | "xmldom": {
224 | "version": "0.1.27",
225 | "bundled": true
226 | }
227 | }
228 | },
229 | "cordova-ios": {
230 | "version": "4.5.5",
231 | "resolved": "https://registry.npmjs.org/cordova-ios/-/cordova-ios-4.5.5.tgz",
232 | "integrity": "sha512-3+30m2dZ2yii7kg+H7cgpdpkXpMj54zoX5imjGGG4Z7dPXKmalTLc/9rLq+Iaa+Q1BqyOrUFaHopWOODRU6vCg==",
233 | "requires": {
234 | "abbrev": "*",
235 | "ansi": "*",
236 | "balanced-match": "*",
237 | "base64-js": "1.2.0",
238 | "big-integer": "*",
239 | "bplist-creator": "*",
240 | "bplist-parser": "*",
241 | "brace-expansion": "*",
242 | "concat-map": "*",
243 | "cordova-common": "2.2.5",
244 | "cordova-registry-mapper": "*",
245 | "elementtree": "0.1.6",
246 | "glob": "5.0.15",
247 | "inflight": "*",
248 | "inherits": "*",
249 | "ios-sim": "6.1.3",
250 | "minimatch": "*",
251 | "nopt": "3.0.6",
252 | "once": "*",
253 | "path-is-absolute": "*",
254 | "plist": "2.1.0",
255 | "q": "1.5.1",
256 | "sax": "0.3.5",
257 | "shelljs": "0.5.3",
258 | "simctl": "*",
259 | "simple-plist": "0.2.1",
260 | "stream-buffers": "2.2.0",
261 | "tail": "0.4.0",
262 | "underscore": "*",
263 | "unorm": "*",
264 | "uuid": "3.0.1",
265 | "wrappy": "*",
266 | "xcode": "0.9.3",
267 | "xml-escape": "1.1.0",
268 | "xmlbuilder": "8.2.2",
269 | "xmldom": "*"
270 | },
271 | "dependencies": {
272 | "abbrev": {
273 | "version": "1.1.1",
274 | "bundled": true
275 | },
276 | "ansi": {
277 | "version": "0.3.1",
278 | "bundled": true
279 | },
280 | "balanced-match": {
281 | "version": "1.0.0",
282 | "bundled": true
283 | },
284 | "base64-js": {
285 | "version": "1.2.0",
286 | "bundled": true
287 | },
288 | "big-integer": {
289 | "version": "1.6.32",
290 | "bundled": true
291 | },
292 | "bplist-creator": {
293 | "version": "0.0.7",
294 | "bundled": true,
295 | "requires": {
296 | "stream-buffers": "~2.2.0"
297 | }
298 | },
299 | "bplist-parser": {
300 | "version": "0.1.1",
301 | "bundled": true,
302 | "requires": {
303 | "big-integer": "^1.6.7"
304 | }
305 | },
306 | "brace-expansion": {
307 | "version": "1.1.11",
308 | "bundled": true,
309 | "requires": {
310 | "balanced-match": "^1.0.0",
311 | "concat-map": "0.0.1"
312 | }
313 | },
314 | "concat-map": {
315 | "version": "0.0.1",
316 | "bundled": true
317 | },
318 | "cordova-common": {
319 | "version": "2.2.5",
320 | "bundled": true,
321 | "requires": {
322 | "ansi": "^0.3.1",
323 | "bplist-parser": "^0.1.0",
324 | "cordova-registry-mapper": "^1.1.8",
325 | "elementtree": "0.1.6",
326 | "glob": "^5.0.13",
327 | "minimatch": "^3.0.0",
328 | "plist": "^2.1.0",
329 | "q": "^1.4.1",
330 | "shelljs": "^0.5.3",
331 | "underscore": "^1.8.3",
332 | "unorm": "^1.3.3"
333 | }
334 | },
335 | "cordova-registry-mapper": {
336 | "version": "1.1.15",
337 | "bundled": true
338 | },
339 | "elementtree": {
340 | "version": "0.1.6",
341 | "bundled": true,
342 | "requires": {
343 | "sax": "0.3.5"
344 | }
345 | },
346 | "glob": {
347 | "version": "5.0.15",
348 | "bundled": true,
349 | "requires": {
350 | "inflight": "^1.0.4",
351 | "inherits": "2",
352 | "minimatch": "2 || 3",
353 | "once": "^1.3.0",
354 | "path-is-absolute": "^1.0.0"
355 | }
356 | },
357 | "inflight": {
358 | "version": "1.0.6",
359 | "bundled": true,
360 | "requires": {
361 | "once": "^1.3.0",
362 | "wrappy": "1"
363 | }
364 | },
365 | "inherits": {
366 | "version": "2.0.3",
367 | "bundled": true
368 | },
369 | "ios-sim": {
370 | "version": "6.1.3",
371 | "bundled": true,
372 | "requires": {
373 | "bplist-parser": "^0.0.6",
374 | "nopt": "1.0.9",
375 | "plist": "^2.1.0",
376 | "simctl": "^1.1.1"
377 | },
378 | "dependencies": {
379 | "bplist-parser": {
380 | "version": "0.0.6",
381 | "bundled": true
382 | },
383 | "nopt": {
384 | "version": "1.0.9",
385 | "bundled": true,
386 | "requires": {
387 | "abbrev": "1"
388 | }
389 | }
390 | }
391 | },
392 | "minimatch": {
393 | "version": "3.0.4",
394 | "bundled": true,
395 | "requires": {
396 | "brace-expansion": "^1.1.7"
397 | }
398 | },
399 | "nopt": {
400 | "version": "3.0.6",
401 | "bundled": true,
402 | "requires": {
403 | "abbrev": "1"
404 | }
405 | },
406 | "once": {
407 | "version": "1.4.0",
408 | "bundled": true,
409 | "requires": {
410 | "wrappy": "1"
411 | }
412 | },
413 | "path-is-absolute": {
414 | "version": "1.0.1",
415 | "bundled": true
416 | },
417 | "plist": {
418 | "version": "2.1.0",
419 | "bundled": true,
420 | "requires": {
421 | "base64-js": "1.2.0",
422 | "xmlbuilder": "8.2.2",
423 | "xmldom": "0.1.x"
424 | }
425 | },
426 | "q": {
427 | "version": "1.5.1",
428 | "bundled": true
429 | },
430 | "sax": {
431 | "version": "0.3.5",
432 | "bundled": true
433 | },
434 | "shelljs": {
435 | "version": "0.5.3",
436 | "bundled": true
437 | },
438 | "simctl": {
439 | "version": "1.1.1",
440 | "bundled": true,
441 | "requires": {
442 | "shelljs": "^0.2.6",
443 | "tail": "^0.4.0"
444 | },
445 | "dependencies": {
446 | "shelljs": {
447 | "version": "0.2.6",
448 | "bundled": true
449 | }
450 | }
451 | },
452 | "simple-plist": {
453 | "version": "0.2.1",
454 | "bundled": true,
455 | "requires": {
456 | "bplist-creator": "0.0.7",
457 | "bplist-parser": "0.1.1",
458 | "plist": "2.0.1"
459 | },
460 | "dependencies": {
461 | "base64-js": {
462 | "version": "1.1.2",
463 | "bundled": true
464 | },
465 | "plist": {
466 | "version": "2.0.1",
467 | "bundled": true,
468 | "requires": {
469 | "base64-js": "1.1.2",
470 | "xmlbuilder": "8.2.2",
471 | "xmldom": "0.1.x"
472 | }
473 | }
474 | }
475 | },
476 | "stream-buffers": {
477 | "version": "2.2.0",
478 | "bundled": true
479 | },
480 | "tail": {
481 | "version": "0.4.0",
482 | "bundled": true
483 | },
484 | "underscore": {
485 | "version": "1.9.1",
486 | "bundled": true
487 | },
488 | "unorm": {
489 | "version": "1.4.1",
490 | "bundled": true
491 | },
492 | "uuid": {
493 | "version": "3.0.1",
494 | "bundled": true
495 | },
496 | "wrappy": {
497 | "version": "1.0.2",
498 | "bundled": true
499 | },
500 | "xcode": {
501 | "version": "0.9.3",
502 | "bundled": true,
503 | "requires": {
504 | "pegjs": "^0.10.0",
505 | "simple-plist": "^0.2.1",
506 | "uuid": "3.0.1"
507 | }
508 | },
509 | "xml-escape": {
510 | "version": "1.1.0",
511 | "bundled": true
512 | },
513 | "xmlbuilder": {
514 | "version": "8.2.2",
515 | "bundled": true
516 | },
517 | "xmldom": {
518 | "version": "0.1.27",
519 | "bundled": true
520 | }
521 | }
522 | },
523 | "cordova-plugin-compat": {
524 | "version": "1.2.0",
525 | "resolved": "https://registry.npmjs.org/cordova-plugin-compat/-/cordova-plugin-compat-1.2.0.tgz",
526 | "integrity": "sha1-C8ZXVyduvZIMASzpIOJ0F3V2Nz4="
527 | },
528 | "cordova-plugin-file": {
529 | "version": "4.3.3",
530 | "resolved": "https://registry.npmjs.org/cordova-plugin-file/-/cordova-plugin-file-4.3.3.tgz",
531 | "integrity": "sha1-AS6Xqhr7kfhJFuY0G1SDZtI96bk="
532 | },
533 | "cordova-plugin-spinner": {
534 | "version": "1.1.0",
535 | "resolved": "https://registry.npmjs.org/cordova-plugin-spinner/-/cordova-plugin-spinner-1.1.0.tgz",
536 | "integrity": "sha1-uy/XiwIO/BgyKlEJsfOMcfKLMlQ="
537 | },
538 | "cordova-plugin-statusbar": {
539 | "version": "2.4.3",
540 | "resolved": "https://registry.npmjs.org/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.4.3.tgz",
541 | "integrity": "sha512-ThmXzl6QIKWFXf4wWw7Q/zpB+VKkz3VM958+5A0sXD4jmR++u7KnGttLksXshVwWr6lvGwUebLYtIyXwS4Ovcg=="
542 | },
543 | "cordova-plugin-whitelist": {
544 | "version": "1.3.4",
545 | "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.4.tgz",
546 | "integrity": "sha512-EYC5eQFVkoYXq39l7tYKE6lEjHJ04mvTmKXxGL7quHLdFPfJMNzru/UYpn92AOfpl3PQaZmou78C7EgmFOwFQQ=="
547 | },
548 | "ionic-plugin-keyboard": {
549 | "version": "2.2.1",
550 | "resolved": "https://registry.npmjs.org/ionic-plugin-keyboard/-/ionic-plugin-keyboard-2.2.1.tgz",
551 | "integrity": "sha1-8qnhabvptVIkADR8n9bTRn7j+hI="
552 | },
553 | "jquery": {
554 | "version": "3.4.0",
555 | "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.0.tgz",
556 | "integrity": "sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ=="
557 | },
558 | "pegjs": {
559 | "version": "0.10.0",
560 | "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz",
561 | "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0="
562 | },
563 | "underscore": {
564 | "version": "1.9.2",
565 | "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.2.tgz",
566 | "integrity": "sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ=="
567 | }
568 | }
569 | }
570 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pdf-generator-test",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "backbone": "^1.4.0",
13 | "cordova-android": "^6.4.0",
14 | "cordova-ios": "^4.5.5",
15 | "cordova-plugin-compat": "^1.2.0",
16 | "cordova-plugin-file": "^4.3.3",
17 | "cordova-plugin-spinner": "^1.1.0",
18 | "cordova-plugin-statusbar": "^2.4.3",
19 | "cordova-plugin-whitelist": "^1.3.4",
20 | "ionic-plugin-keyboard": "^2.2.1",
21 | "jquery": "^3.4.0",
22 | "underscore": "^1.8.3"
23 | },
24 | "cordova": {
25 | "platforms": [
26 | "ios",
27 | "android"
28 | ],
29 | "plugins": {
30 | "cordova-plugin-statusbar": {},
31 | "cordova-plugin-whitelist": {},
32 | "ionic-plugin-keyboard": {},
33 | "cordova-plugin-spinner": {},
34 | "cordova-plugin-file": {},
35 | "cordova-pdf-generator": {}
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/www/css/index.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | * {
20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
21 | }
22 |
23 | body {
24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
27 | background-color:#E4E4E4;
28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
31 | background-image:-webkit-gradient(
32 | linear,
33 | left top,
34 | left bottom,
35 | color-stop(0, #A7A7A7),
36 | color-stop(0.51, #E4E4E4)
37 | );
38 | background-attachment:fixed;
39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
40 | font-size:12px;
41 | height:100%;
42 | margin:0px;
43 | padding:0px;
44 | text-transform:uppercase;
45 | width:100%;
46 | }
47 |
48 | /* Portrait layout (default) */
49 | .app {
50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
51 | position:absolute; /* position in the center of the screen */
52 | left:50%;
53 | top:50%;
54 | height:50px; /* text area height */
55 | width:225px; /* text area width */
56 | text-align:center;
57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */
58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */
59 | /* offset horizontal: half of text area width */
60 | }
61 |
62 | /* Landscape layout (with min-width) */
63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
64 | .app {
65 | background-position:left center;
66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */
67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */
68 | /* offset horizontal: half of image width and text area width */
69 | }
70 | }
71 |
72 | h1 {
73 | font-size:24px;
74 | font-weight:normal;
75 | margin:0px;
76 | overflow:visible;
77 | padding:0px;
78 | text-align:center;
79 | }
80 |
81 | .event {
82 | border-radius:4px;
83 | -webkit-border-radius:4px;
84 | color:#FFFFFF;
85 | font-size:12px;
86 | margin:0px 30px;
87 | padding:2px 0px;
88 | }
89 |
90 | .event.listening {
91 | background-color:#333333;
92 | display:block;
93 | }
94 |
95 | .event.received {
96 | background-color:#4B946A;
97 | display:none;
98 | }
99 |
100 | @keyframes fade {
101 | from { opacity: 1.0; }
102 | 50% { opacity: 0.4; }
103 | to { opacity: 1.0; }
104 | }
105 |
106 | @-webkit-keyframes fade {
107 | from { opacity: 1.0; }
108 | 50% { opacity: 0.4; }
109 | to { opacity: 1.0; }
110 | }
111 |
112 | .blink {
113 | animation:fade 3000ms infinite;
114 | -webkit-animation:fade 3000ms infinite;
115 | }
116 |
--------------------------------------------------------------------------------
/www/full.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Hello World
8 |
9 |
10 |
18 |
19 |
20 | Hello World
21 |
22 |
Hello.....
23 | Testing UTF-8:
測試- تجريب - δοκιμή
24 |
25 |
26 |
27 |
28 | Testing Image Drawing
29 |
30 |
31 |
32 |
33 |
34 | Testing Image Drawing using SSL
35 |
36 |
37 |
38 |
39 |
40 | Testing Image Drawing using Firebase
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/www/img/fractal.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/www/img/fractal.jpeg
--------------------------------------------------------------------------------
/www/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cesarvr/pdf-generator-example/cf7e61b5bf5302c354e8795dfbb78d7f801619aa/www/img/logo.png
--------------------------------------------------------------------------------
/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | PDF Generator plugin
35 |
36 |
37 |
39 |
40 |
41 |
43 |
44 |
45 |
49 |
50 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
109 |
110 |
111 |
112 |
113 |
PDF Generator Cordova Plugin
114 |
115 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
394 |
395 |
396 |
397 |
398 |
399 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
--------------------------------------------------------------------------------
/www/js/index.js:
--------------------------------------------------------------------------------
1 | /* global pdf */
2 | /* global $ */
3 | /* global Backbone */
4 | /* global cordova */
5 |
6 | var $ = require('jquery');
7 | var _ = require('underscore');
8 | var Backbone = require('backbone');
9 |
10 | var DEBUG = ((typeof cordova) === 'undefined');
11 |
12 |
13 | function progressShow() {
14 |
15 | if (!_.isEmpty(window.cordova)) {
16 | SpinnerPlugin.activityStart("Generating PDF...", {
17 | dimBackground: true
18 | });
19 | }
20 |
21 | };
22 |
23 | function progressHide() {
24 | if (!_.isEmpty(window.cordova)) {
25 | SpinnerPlugin.activityStop();
26 | }
27 | };
28 |
29 | function success(msg) {
30 |
31 | if (!_.isEmpty(msg))
32 | $('#baseH').html('base64:' + msg.replace('\n', ''));
33 |
34 | // $.post("http://localhost:3000/save", {
35 | // pdfData: msg
36 | // })
37 | // .done(function(data) {
38 | // alert("Data Loaded: " + data);
39 | // });
40 |
41 | progressHide();
42 | };
43 |
44 | function failure(err) {
45 | console.error('->', err);
46 | console.alert('An error has ocurred: ', err);
47 |
48 | progressHide();
49 | };
50 |
51 |
52 | var HomeView = Backbone.View.extend({
53 |
54 | initialize: function() {
55 | this.$button = this.$el.find('#generate');
56 | this.$url = this.$el.find('#url');
57 | this.$urlShare = this.$el.find('#url-share');
58 | this.$internalUrlShare = this.$el.find('#internal-url-share');
59 |
60 | this.$raw = this.$el.find('#rawhtml');
61 | this.$html = this.$el.find('#html');
62 | this.$display = this.$el.find('#display');
63 |
64 | this.success = success.bind(this);
65 | this.failure = failure.bind(this);
66 | },
67 |
68 | events: {
69 | 'click #generate': 'makePDFBase64',
70 | 'click #share': 'makePDFAndShare',
71 | 'click #internal-share': 'internalPDFAndShare',
72 | 'click #share-raw': 'makeRawPDFandShare',
73 | },
74 |
75 | makePDFBase64: function(e) {
76 | e.preventDefault()
77 | progressShow()
78 |
79 |
80 |
81 | var opts = {
82 | documentSize: "A4",
83 | landscape: "portrait",
84 | type: "base64"
85 | }
86 |
87 | /* generate pdf using url. */
88 | pdf.fromURL(this.$url.val(),opts)
89 | .then(this.success)
90 | .catch(this.failure);
91 | },
92 |
93 | internalPDFAndShare: function(e) {
94 | e.preventDefault();
95 |
96 | progressShow();
97 | /* generate pdf using url. */
98 |
99 | if (cordova.platformId === 'ios') {
100 | console.log('Testing URL->', url)
101 | window.resolveLocalFileSystemURL(cordova.file.applicationDirectory,
102 | (url) => {
103 | var file = this.$internalUrlShare.val().replace('file:///android_asset/', url.nativeURL);
104 |
105 | pdf.htmlToPDF({
106 | url: file,
107 | documentSize: "A4",
108 | landscape: "portrait",
109 | type: "share"
110 | }, this.success, this.failure);
111 | },
112 | (err) =>
113 | console.log('error', err, ' args ->', arguments)
114 | );
115 | } else {
116 |
117 | pdf.htmlToPDF({
118 | url: this.$internalUrlShare.val(),
119 | documentSize: "A4",
120 | landscape: "portrait",
121 | type: "share"
122 | }, this.success, this.failure);
123 | }
124 | },
125 |
126 | makePDFAndShare: function(e) {
127 | e.preventDefault();
128 | progressShow();
129 | /* generate pdf using url. */
130 |
131 | debugger
132 |
133 | var opts = {
134 | documentSize: "A4",
135 | landscape: "portrait",
136 | type: "share",
137 | fileName: $('#filename').val() || 'my-pdf.pdf'
138 | }
139 |
140 |
141 | pdf.fromURL(this.$urlShare.val(),
142 | opts)
143 | .then(this.success)
144 | .catch(this.failure);
145 | },
146 |
147 | makeRawPDFandShare: function(e) {
148 | e.preventDefault();
149 |
150 | progressShow();
151 | /* generate pdf using url. */
152 | var opts = {
153 | documentSize: "A4",
154 | landscape: "portrait",
155 | type: "share"
156 | }
157 |
158 | pdf
159 | .fromData(this.$raw.val(), opts)
160 | .then((pdf)=>{
161 | $('#rawH').html(pdf);
162 | progressHide();
163 | }).catch(this.failure)
164 | }
165 | });
166 |
167 | var DemoRouter = Backbone.Router.extend({
168 | routes: {
169 | '*path': 'index',
170 | },
171 |
172 | index: function() {
173 | new HomeView({
174 | el: $('.starter-template')
175 | });
176 | }
177 | });
178 |
179 |
180 | if (DEBUG) {
181 | console.log('start app..');
182 |
183 | new DemoRouter();
184 | Backbone.history.start();
185 | } else {
186 | document.addEventListener('deviceready', function() {
187 |
188 | console.log('start app..');
189 |
190 |
191 |
192 | new DemoRouter();
193 | Backbone.history.start();
194 | }, false);
195 |
196 | }
197 |
--------------------------------------------------------------------------------
/www/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cordova-pdf-example",
3 | "version": "2.0.0",
4 | "description": "",
5 | "main": "bundle.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "backbone": "^1.3.3",
13 | "jquery": "^3.1.1",
14 | "underscore": "^1.8.3"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/www/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello World
6 |
7 |
8 | Hello World
9 |
10 |
Hello.....
11 | Testing UTF-8:
測試- تجريب - δοκιμή
12 |
13 |
14 |
15 |
16 | Testing Image Drawing
17 |
18 |
19 |
20 |
21 |
22 | Testing Image Drawing using SSL
23 |
24 |
25 |
26 |
27 |
28 | Testing Image Drawing using Firebase
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/www/webpack.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | entry: './js/index.js',
3 |
4 | output: {
5 | filename: 'bundle.js',
6 | },
7 |
8 | module: {
9 | loaders: [{
10 | test: /\.html$/,
11 | loader: "ejs-loader?variable=data"
12 | }],
13 | }
14 | }
--------------------------------------------------------------------------------