forked from parallax/jsPDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvfs.js
More file actions
50 lines (44 loc) · 1.13 KB
/
Copy pathvfs.js
File metadata and controls
50 lines (44 loc) · 1.13 KB
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
/**
* jsPDF virtual FileSystem functionality
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
/**
* Use the vFS to handle files
*/
(function (jsPDFAPI) {
"use strict";
var vFS = {};
/* Check if the file exists in the vFS
* @returns {boolean}
* @name existsFileInVFS
* @example
* doc.existsFileInVFS("someFile.txt");
*/
jsPDFAPI.existsFileInVFS = function (filename) {
return vFS.hasOwnProperty(filename);
}
/* Add a file to the vFS
* @returns {jsPDF}
* @name addFileToVFS
* @example
* doc.addFileToVFS("someFile.txt", "BADFACE1");
*/
jsPDFAPI.addFileToVFS = function (filename, filecontent) {
vFS[filename] = filecontent;
return this;
};
/* Get the file from the vFS
* @returns {string}
* @name addFileToVFS
* @example
* doc.getFileFromVFS("someFile.txt");
*/
jsPDFAPI.getFileFromVFS = function (filename) {
if (vFS.hasOwnProperty(filename)) {
return vFS[filename];
}
return null;
};
})(jsPDF.API);